CoffeeScript
Accelerated JavaScript Development, Second Edition
by: Trevor Burnham
Published | 2015-02-07 |
---|---|
Internal code | tbcoffee2 |
Print status | In Print |
Pages | 122 |
User level | Beginner |
Keywords | javascript, coffee, coffescript, |
Related titles | Async JavaScript and all Rails books |
ISBN | 9781941222263 |
Other ISBN |
Channel epub: 9781680503241 Channel PDF: 9781680503258 Kindle: 9781680500998 Safari: 9781680501001 Kindle: 9781680500998 |
BISACs | COM051260 COMPUTERS / Programming Languages / JavaScriptCOM060160 COMPUTERS / Web / Web ProgrammingCOM060160 COMPUTERS / Web / Web Programming |
Highlight
Over the last five years, CoffeeScript has taken the web development world by storm. With the humble motto “It’s just JavaScript,” CoffeeScript provides all the power of the JavaScript language in a friendly and elegant package. This extensively revised and updated new edition includes an all-new project to demonstrate CoffeeScript in action, both in the browser and on a Node.js server. There’s no faster way to learn to write a modern web application.
Description
This new edition has been extensively revised and updated to reflect the current state and features of CoffeeScript. Every chapter has been revised and refactored, and new sections and a new chapter on testing have been added. If you already know JavaScript, this book will make your transition to CoffeeScript easy. If you’re new to JavaScript, it’s a great place to start.
New in this edition:
- Automating setup with the Grunt task runner
- Using CoffeeScript classes with the Backbone framework
- Using CoffeeScript’s simple callback syntax to interact with the Express framework
- A new chapter on client-side and server-side testing with Intern
- A new project that gives you hands-on experience with browser-side and server-side CoffeeScript
CoffeeScript is every bit as portable and effective as JavaScript. It aids development by adding a bevy of features, such as classes, splats, list comprehensions, and destructuring. These features make it easier to write clear, readable code, and by learning how these features work, you’ll deepen your understanding of JavaScript as well. This book is your complete guide to writing better JavaScript code, faster.
Top 5 Ways the CoffeeScript World Has Evolved
by Trevor Burnham
1. Source maps! This long-awaited feature allows stack traces to reference the original CoffeeScript source code, rather than the compiled JavaScript. This makes debugging much easier, breaking down the barrier between “pure” JavaScript and machine-made JavaScript.
2. Next-generation build tools. Grunt and its ilk make it much easier to manage complex project toolchains with scripts for compiling, minifying, and running code during development. That’s great news for CoffeeScripters working outside of Rails.
3. The spread of Node. When the first edition of the book came out, Windows users had to use an emulated Linux environment like Cygwin to use Node-based CoffeeScript tools. Node has come a long way since then. You probably already have it on your machine, and if you don’t, it’s a breeze to install.
4. A mature community. Top-tier tech companies like 37signals and GitHub use CoffeeScript production, and the style of CoffeeScript code has become more standardized as a result. Plus, it’s easy to find help on Stack Overflow.
5. ECMAScript 6. Many of CoffeeScript’s features (shorthand function syntax, classes, destructuring…) have been embraced and adopted as part of the next generation of JavaScript. The ES6 standard hasn’t yet been ratified, so CoffeeScript allows you to enjoy the future of JavaScript, today!
Contents and Extracts
- Getting Started
- Installing CoffeeScript
- Running and Compiling CoffeeScript
- Editing CoffeeScript
- Functions, Scope, and Context
- Functions 101
- Variable Scope
- Execution Context
- Mini-Project: Checkbook Balancer
- Wow! Such Function! So Coffee!
- Collections, Iteration, and Destructuring
- Objects as Hash Maps
- Arrays
- Iterating over Collections
- Mini-Project: Refactored Checkbook Balancer
- Gotta Catch ’Em All
- Classes, Prototypes, and Inheritance
- The Power of Prototypes
- Classes: Giving Prototypes Structure
- Inheritance: Classy Prototype Chains
- Mini-Project: All-Purpose Checkbook Balancer
- Just a Spoonful of Sugar
- Web Applications with jQuery and Backbone.js
- Building Our Project with Grunt
- Managing Front-End Dependencies with Bower
- Building the Page with Templates
- Structuring Data for Persistence
- Representing Data in Backbone Models and Collections
- Presenting Data with Views
- Finishing Touches
- Tasks that last
- Web Servers with Node and Express
- What Is Node? excerpt
- Writing Node modules
- Compiling a Node project with Grunt
- Creating a web server with Express and NeDB
- Using a RESTful API in Backbone
- A brief encounter with Node