Buy Programming in CoffeeScript by Mark Bates at Bookstore UAE
close menu
Bookswagon
search
My Account
Home > Computing and Information Technology Books > Computer programming / software engineering > Web programming > Programming in CoffeeScript
Programming in CoffeeScript

Programming in CoffeeScript


     0     
5
4
3
2
1



Out of Stock


Notify me when this book is in stock
X
About the Book

Use CoffeeScript to Write Better JavaScript Code Than Ever Before!

 

If you can do it in JavaScript, you can do it better in CoffeeScript. And, since CoffeeScript “compiles down” to JavaScript, your code will fit neatly into virtually any web environment. In Programming in CoffeeScript, Mark Bates shows web developers why CoffeeScript is so useful and how it avoids the problems that often make JavaScript code buggy and unmanageable. He guides you through every feature and technique you need to write quality CoffeeScript code and shows how to take advantage of CoffeeScript’s increasingly robust toolset.

 

Bates begins with the absolute basics of running and compiling CoffeeScript and then introduces syntax, control structures, functions, collections, and classes. Through same page code comparisons, you’ll discover exactly how CoffeeScript improves on JavaScript. Next, you’ll put it to work in building applications that are powerful, flexible, maintainable, concise, reliable, and secure. Bates shares valuable tips for better development, illuminating CoffeeScript’s hidden gems and warning you about its remaining “rough edges.” The book concludes with a start-to-finish application case study showing how to code back-ends and front-ends and integrate powerful frameworks and libraries. Coverage includes

  • Understanding the right ways to compile and execute CoffeeScript
  • Using CoffeeScript’s clean syntax to focus on your code, not JavaScript’s distractions
  • Working with CoffeeScript’s control structures, functions, and arguments
  • Taking full advantage of CoffeeScript’s implementation of collections and iterators
  • Leveraging CoffeeScript’s full class support to create complex data models
  • Automating common application development tasks with Cake and Cakefiles
  • Configuring Jasmine with CoffeeScript support, and using it to systematically test your code
  • Writing Node.js server-side applications in CoffeeScript
  • Using CoffeeScript to write jQuery and Backbone.js applications
  • Integrating framework code to avoid “reinventing the wheel”

Want a better way to create the JavaScript code your web applications need? CoffeeScript is the solution–and this book will help you master it!


 



Table of Contents:

Dedication v

Acknowledgments xii

About the Author xiv

Preface xv

What Is CoffeeScript? xvii

Who Is This Book For? xix

How to Read This Book xix

How This Book Is Organized xxi

Part I: Core CoffeeScript xxii

Part II: CoffeeScript in Practice xxii

Installing CoffeeScript xxiii

How to Run the Examples xxiii

Notes xxiv

Part I: Core CoffeeScript

1 Getting Started 3

The CoffeeScript REPL 3

In-Browser Compilation 6

Caveats 7

Command-Line Compilation 7

The compile Flag 7

The CoffeeScript CLI 8

The output Flag 9

The bare Flag 9

The print Flag 10

The watch Flag 10

Executing CoffeeScript Files 11

Other Options 11

Wrapping Up 12

Notes 12

2 The Basics 13

Syntax 13

Significant Whitespace 14

Function Keyword 16

Parentheses 16

Scope and Variables 18

Variable Scope in JavaScript 18

Variable Scope in CoffeeScript 19

The Anonymous Wrapper Function 20

Interpolation 23

String Interpolation 23

Interpolated Strings 23

Literal Strings 25

Heredocs 28

Comments 29

Inline Comments 29

Block Comments 30

Extended Regular Expressions 31

Wrapping Up 31

Notes 32

3 Control Structures 33

Operators and Aliases 33

Arithmetic 33

Assignment 35

Comparison 39

String 42

The Existential Operator 43

Aliases 46

The is and isnt Aliases 47

The not Alias 48

The and and or Aliases 49

The Boolean Aliases 50

The @ Alias 51

If/Unless 52

The if Statement 53

The if/else Statement 54

The if/else if Statement 56

The unless Statement 58

Inline Conditionals 60

Switch/Case Statements 60

Wrapping Up 63

Notes 63

4 Functions and Arguments 65

Function Basics 68

Arguments 70

Default Arguments 72

Splats... 75

Wrapping Up 79

Notes 79

5 Collections and Iterations 81

Arrays 81

Testing Inclusion 83

Swapping Assignment 85

Multiple Assignment aka Destructing Assignment 86

Ranges 90

Slicing Arrays 92

Replacing Array Values 94

Injecting Values 95

Objects/Hashes 96

Getting/Setting Attributes 101

Destructuring Assignment 103

Loops and Iteration 105

Iterating Arrays 105

The by Keyword 106

The when Keyword 107

Iterating Objects 108

The by Keyword 109

The when Keyword 109

The own Keyword 110

while Loops 113

until Loops 114

Comprehensions 116

The do Keyword 119

Wrapping Up 120

Notes 121

6 Classes 123

Defining Classes 123

Defining Functions 125

The constructor Function 126

Scope in Classes 127

Extending Classes 137

Class-Level Functions 145

Prototype Functions 150

Binding (-> Versus =>) 151

Wrapping Up 158

Notes 158

Part II: CoffeeScript in Practice

7 Cake and Cakefiles 161

Getting Started 161

Creating Cake Tasks 162

Running Cake Tasks 163

Using Options 163

Invoking Other Tasks 167

Wrapping Up 169

Notes 170

8 Testing with Jasmine 171

Installing Jasmine 172

Setting Up Jasmine 172

Introduction to Jasmine 175

Unit Testing 176

Before and After 181

Custom Matchers 187

Wrapping Up 190

Notes 191

9 Intro to Node.js 193

What Is Node.js? 193

Installing Node 194

Getting Started 195

Streaming Responses 197

Building a CoffeeScript Server 199

Trying Out the Server 214

Wrapping Up 215

Notes 215

10 Example: Todo List Part 1 (Server-side) 217

Installing and Setting Up Express 218

Setting Up MongoDB Using Mongoose 222

Writing the Todo API 225

Querying with Mongoose 226

Finding All Todos 227

Creating New Todos 228

Getting, Updating, and Destroying a Todo 230

Cleaning Up the Controller 232

Wrapping Up 236

Notes 236

11 Example: Todo List Part 2 (Client-side w/ jQuery) 237

Priming the HTML with Twitter Bootstrap 237

Interacting with jQuery 240

Hooking Up the New Todo Form 242

Cleaning Up the Todo List with Underscore.js

Templates 244

Listing Existing Todos 247

Updating Todos 248

Deleting Todos 252

Wrapping Up 253

Notes 253

12 Example: Todo List Part 3 (Client-side w/ Backbone.js) 255

What Is Backbone.js? 255

Cleaning Up 256

Setting Up Backbone.js 256

Writing our Todo Model and Collection 260

Listing Todos Using a View 263

Creating New Todos 265

A View per Todo 268

Updating and Validating Models from Views 270

Validation 272

Deleting Models from Views 273

Wrapping Up 275

Notes 275

Index 277



About the Author :

Mark Bates is the founder and chief architect of the Boston-based consulting company Meta42 Labs. Mark spends his days focusing on new application development and consulting for his clients. At night he writes books, raises kids, and occasionally he forms a band and “tries to make it.”

 

Mark has been writing web applications, in one form or another, since 1996. His career started as a UI developer writing HTML and JavaScript applications before moving toward the middle(ware) with Java and Ruby. Nowadays, Mark spends his days cheating on Ruby with his new mistress, CoffeeScript.

 

Always wanting to share his wisdom, or more correctly just wanting to hear the sound of his own voice, Mark has spoken at several high-profile conferences, including RubyConf, RailsConf, and jQueryConf. Mark has also taught classes on Ruby and Ruby on Rails. In 2009 Mark’s first (surprisingly not his last!) book, Distributed Programming with Ruby, was published by Addison-Wesley.

 

Mark lives just outside of Boston with his wife, Rachel, and their two sons, Dylan and Leo. Mark can be found on the web at: http://www.markbates.com, http://twitter.com/markbates, and http://github.com/markbates.


Best Sellers


Product Details
  • ISBN-13: 9780321820105
  • Publisher: Pearson Education (US)
  • Publisher Imprint: Addison-Wesley Educational Publishers Inc
  • Height: 226 mm
  • No of Pages: 320
  • Weight: 506 gr
  • ISBN-10: 032182010X
  • Publisher Date: 07 Jun 2012
  • Binding: Paperback
  • Language: English
  • Spine Width: 18 mm
  • Width: 180 mm


Similar Products

Add Photo
Add Photo

Customer Reviews

REVIEWS      0     
Click Here To Be The First to Review this Product
Programming in CoffeeScript
Pearson Education (US) -
Programming in CoffeeScript
Writing guidlines
We want to publish your review, so please:
  • keep your review on the product. Review's that defame author's character will be rejected.
  • Keep your review focused on the product.
  • Avoid writing about customer service. contact us instead if you have issue requiring immediate attention.
  • Refrain from mentioning competitors or the specific price you paid for the product.
  • Do not include any personally identifiable information, such as full names.

Programming in CoffeeScript

Required fields are marked with *

Review Title*
Review
    Add Photo Add up to 6 photos
    Would you recommend this product to a friend?
    Tag this Book Read more
    Does your review contain spoilers?
    What type of reader best describes you?
    I agree to the terms & conditions
    You may receive emails regarding this submission. Any emails will include the ability to opt-out of future communications.

    CUSTOMER RATINGS AND REVIEWS AND QUESTIONS AND ANSWERS TERMS OF USE

    These Terms of Use govern your conduct associated with the Customer Ratings and Reviews and/or Questions and Answers service offered by Bookswagon (the "CRR Service").


    By submitting any content to Bookswagon, you guarantee that:
    • You are the sole author and owner of the intellectual property rights in the content;
    • All "moral rights" that you may have in such content have been voluntarily waived by you;
    • All content that you post is accurate;
    • You are at least 13 years old;
    • Use of the content you supply does not violate these Terms of Use and will not cause injury to any person or entity.
    You further agree that you may not submit any content:
    • That is known by you to be false, inaccurate or misleading;
    • That infringes any third party's copyright, patent, trademark, trade secret or other proprietary rights or rights of publicity or privacy;
    • That violates any law, statute, ordinance or regulation (including, but not limited to, those governing, consumer protection, unfair competition, anti-discrimination or false advertising);
    • That is, or may reasonably be considered to be, defamatory, libelous, hateful, racially or religiously biased or offensive, unlawfully threatening or unlawfully harassing to any individual, partnership or corporation;
    • For which you were compensated or granted any consideration by any unapproved third party;
    • That includes any information that references other websites, addresses, email addresses, contact information or phone numbers;
    • That contains any computer viruses, worms or other potentially damaging computer programs or files.
    You agree to indemnify and hold Bookswagon (and its officers, directors, agents, subsidiaries, joint ventures, employees and third-party service providers, including but not limited to Bazaarvoice, Inc.), harmless from all claims, demands, and damages (actual and consequential) of every kind and nature, known and unknown including reasonable attorneys' fees, arising out of a breach of your representations and warranties set forth above, or your violation of any law or the rights of a third party.


    For any content that you submit, you grant Bookswagon a perpetual, irrevocable, royalty-free, transferable right and license to use, copy, modify, delete in its entirety, adapt, publish, translate, create derivative works from and/or sell, transfer, and/or distribute such content and/or incorporate such content into any form, medium or technology throughout the world without compensation to you. Additionally,  Bookswagon may transfer or share any personal information that you submit with its third-party service providers, including but not limited to Bazaarvoice, Inc. in accordance with  Privacy Policy


    All content that you submit may be used at Bookswagon's sole discretion. Bookswagon reserves the right to change, condense, withhold publication, remove or delete any content on Bookswagon's website that Bookswagon deems, in its sole discretion, to violate the content guidelines or any other provision of these Terms of Use.  Bookswagon does not guarantee that you will have any recourse through Bookswagon to edit or delete any content you have submitted. Ratings and written comments are generally posted within two to four business days. However, Bookswagon reserves the right to remove or to refuse to post any submission to the extent authorized by law. You acknowledge that you, not Bookswagon, are responsible for the contents of your submission. None of the content that you submit shall be subject to any obligation of confidence on the part of Bookswagon, its agents, subsidiaries, affiliates, partners or third party service providers (including but not limited to Bazaarvoice, Inc.)and their respective directors, officers and employees.

    Accept

    Fresh on the Shelf


    Inspired by your browsing history


    Your review has been submitted!

    You've already reviewed this product!
    Your IP: 216.73.216.252 IN