small medium large xlarge

CoffeeScript: Accelerated JavaScript Development, Second Edition

by

Cover image for CoffeeScript

CoffeeScript

by

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.

Choose Your Format(s)

  • $37.00 In Stock

    Save $13.00 on the combo pack.

  • $29.00 In Stock
  • $21.00 In Stock
  • Ebooks are DRM free.

  • Ebook delivery options.

About this Title

Skill-meter-1-4
Pages: 124
Published: 2015-02-07
Release: P1.0 (2015-02-17)
ISBN: 978-1-94122-226-3

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!

What You Need

Some prior experience with object-oriented programming in a language such as Ruby, Python, or JavaScript is strongly recommended.

Contents & 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
  • 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

Author

Trevor Burnham is a full-stack web developer living in Cambridge, MA. You can reach him on Twitter, where he goes by @TrevorBurnham and @CoffeeScript.