The Little Book on CoffeeScript
The JavaScript Developer's Guide to Building Better Web Apps
Publisher: O'Reilly Media
Final Release Date: January 2012
Pages: 62

This concise book shows JavaScript developers how to build superb web applications with CoffeeScript, the remarkable language that’s gaining considerable interest. Through example code, this guide demonstrates how CoffeeScript abstracts JavaScript, providing syntactical sugar and preventing many common errors. You’ll learn CoffeeScript’s syntax and idioms step by step, from basic variables and functions to complex comprehensions and classes.

Written by Alex MacCaw, author of JavaScript Web Applications (O’Reilly), with contributions from CoffeeScript creator Jeremy Ashkenas, this book quickly teaches you best practices for using this language—not just on the client side, but for server-side applications as well. It’s time to take a ride with the little language that could.

  • Discover how CoffeeScript’s syntax differs from JavaScript
  • Learn about features such as array comprehensions, destructuring assignments, and classes
  • Explore CoffeeScript idioms and compare them to their JavaScript counterparts
  • Compile CoffeeScript files in static sites with the Cake build system
  • Use CommonJS modules to structure and deploy CoffeeScript client-side applications
  • Examine JavaScript’s bad parts—including features CoffeeScript was able to fix
Table of Contents
Product Details
About the Author
Recommended for You
Customer Reviews

REVIEW SNAPSHOT®

by PowerReviews
oreillyThe Little Book on CoffeeScript
 
4.2

(based on 6 reviews)

Ratings Distribution

  • 5 Stars

     

    (1)

  • 4 Stars

     

    (5)

  • 3 Stars

     

    (0)

  • 2 Stars

     

    (0)

  • 1 Stars

     

    (0)

100%

of respondents would recommend this to a friend.

Pros

  • Concise (5)
  • Well-written (5)
  • Easy to understand (4)
  • Helpful examples (4)
  • Accurate (3)

Cons

    Best Uses

    • Intermediate (4)
    • Expert (3)
      • Reviewer Profile:
      • Developer (4)

    Reviewed by 6 customers

    Sort by

    Displaying reviews 1-6

    Back to top

     
    4.0

    A very good start to the language.

    By Wilson

    from Sao Paulo, Brasil

    Verified Buyer

    Pros

    • Accurate
    • Concise
    • Easy to understand
    • Well-written

    Cons

      Best Uses

        Comments about oreilly The Little Book on CoffeeScript:

        Very good start, concise.

        (0 of 1 customers found this review helpful)

         
        4.0

        Fine Book

        By Aloptec

        from DE Darmstadt

        Verified Buyer

        Comments about oreilly The Little Book on CoffeeScript:

        I like it very much. It helps me. Thanks!

        (5 of 6 customers found this review helpful)

         
        4.0

        A compact introduction to CoffeeScript

        By Aaron Sumner

        from Lawrence, KS

        About Me Developer

        Verified Reviewer

        Pros

        • Concise
        • Helpful examples
        • Well-written

        Cons

          Best Uses

          • Expert
          • Intermediate

          Comments about oreilly The Little Book on CoffeeScript:

          It's not a secret that I think JavaScript is ugly. Maybe it's because I've been developing almost solely in Ruby for the past several years. If you're in the same boat (or if you're a Python developer who feels the same way I do about JavaScript) you've likely heard of of CoffeeScript, an alternative language that compiles neatly into JavaScript. Alex MacCaw's A Little Book on CoffeeScript is a solid introduction to the little language.

          A Little Book on CoffeeScript is indeed little (checking in at six chapters in about 60 pages in PDF form), but offers a thorough introduction to the language and how it can make your life with JavaScript simpler. The book dives right into syntax, then on through classes, idiomatic usage, a little big picture stuff (creating and deploying apps written in CoffeeScript), and closes with a look at what CoffeeScript fixes (and doesn't fix) in JavaScript. I've viewed a few screencasts on CoffeeScript and even written a little in the language, but I still learned some new things from this book. In particular, the chapters on idioms and "the good parts" will be of use to anyone making the switch, so you won't try to apply JavaScript's ugliness to what is actually a pretty little language. These chapters alone should make the book worth buying for many developers.

          With that said, this book is not for someone with no JavaScript experience, and definitely not for someone with zero programming experience. It's not a tutorial; it's more like a guided tour of CoffeeScript's feature set. There are plenty of examples, and I recommend using the interactive console on the CoffeeScript website to experiment with these examples as you read through the book. If nothing else, you'll get an appreciation of just how much typing CoffeeScript is saving you.

          While perhaps not a definitive reference on the topic, A Little Book on CoffeeScript is a solid overview of what makes CoffeeScript so promising. It's got just enough in terms of examples for developers with a little experience, and delivers lots of practical advice for succeeding with the language. All that in a book you can read in an hour or so.

          Note: I wrote this review for O'Reilly's Blogger Review Program.

          (2 of 3 customers found this review helpful)

           
          4.0

          Good introduction to CoffeeScript

          By Lola

          from Kitchener, ON

          About Me Developer

          Verified Reviewer

          Pros

          • Accurate
          • Concise
          • Easy to understand
          • Helpful examples
          • Well-written

          Cons

            Best Uses

            • Expert
            • Intermediate

            Comments about oreilly The Little Book on CoffeeScript:

            The Little Book on CoffeeScript, by Alex MacCaw, provides a quick dive into CoffeeScript, a new scripting language which is based off of, and compiles to, JavaScript. It is a simpler form of JavaScript, with syntax and feature implementation that is inspired by both Ruby and Python.

            The author does a great job of explaining the differences within CoffeeScript over the JavaScript language, such as using Ruby-style string interpolation instead of JavaScript's string addition and using Python-style comprehensions over JavaScript-style for loops.

            The meat of the book is contained in chapters 2 – 4, diving right into classes, CoffeeScript idioms, and compilation. Throughout the book, the author provides concise code examples to demonstrate the use of CoffeeScript in place of JavaScript, making it easy to follow and understand.

            The final chapter of the book was written by Jeremy Ashkenas, the author of CoffeeScript, explaining the philosophy and intent of the language. He simply states that it is "just JavaScript" and encourages readers to experiment with their own compile-to-JavaScript languages, which I thought was a neat way to close off the book.

            This book is meant for those that have some experience or background with either JavaScript, Ruby or Python. Without that, readers will not get much out of the book, as it is not meant for beginners.

            Intermediate and senior developers will find this book to be quite useful as an introduction into CoffeeScript and its implementation.

            Kudos to the author for delivering so much information in less than 43 pages. This book is an easy read, a great start for developers looking to transition from traditional JavaScript to CoffeeScript, and useful to keep handy as a reference book.

            (1 of 1 customers found this review helpful)

             
            5.0

            CoffeeScript -> JavaScript + Awesome

            By jQuery Rocks

            from USA

            About Me Developer, Sys Admin

            Verified Reviewer

            Pros

            • Concise
            • Easy to understand
            • Helpful examples
            • Well-written

            Cons

              Best Uses

              • Advanced Student
              • Expert
              • Intermediate

              Comments about oreilly The Little Book on CoffeeScript:

              JavaScript is a quirky, peculiar language – and yet it shines as a fun, productive language, especially when you add jQuery or Dojo to the mix. CoffeeScript caught my eye when it first started appearing on my favorite web development blogs; any tool that can fix the oddities of JavaScript programming gets my full attention, so I was excited to read this book. In retrospect, I'm very glad I picked up this short book.

              Alex nicely covers the use and syntax of CoffeeScript, starting with variable and function declarations, arrays, and logic branching statements (most books on a language begin with these building blocks, so no surprise there). This new language results in significant alterations to the syntax and structure of JavaScript; CoffeeScript bears a strong resemblance to Python, especially in its use of whitespace and indentation, as opposed to the curly braces typically used in JavaScript and other C-style languages. If you're looking for a library that simply enhances JS, as jQuery does, then you might not like CoffeeScript – but I think it's definitely worth learning the alternative syntax of this small new language. I was pleasantly surprised that jQuery and CoffeeScript can easily be used together, effectively complementing each other.

              I found chapters 2, 3, and 4 to be the most immediately useful sections in the book. Classes are discussed in chapter two – creating them revolves entirely around the "class" keyword, which is logical enough. You can create instances of the class with the "new" keyword, and both static properties and instance properties can be included in a given CoffeeScript class. There is also an "extends" keyword for inheritance, and an easy way to create a constructor method.

              Chapter 3 starts with the CoffeeScript versions of ECMAScript 5 additions. The "each" function is more efficient than the ES5 equivalents, "forEach" and "map", due to the way the CoffeeScript code is compiled into JS. Some time is also spent describing the "natural language" style of logical comparisons, using "and", "or", and "is" instead of "&&", "||", and "==".

              Chapter 4 is really cool, and answers a lot of practical questions about implementation. Cake is discussed as a way to compile CoffeeScript; later, the author outlines using Node (server-side JS) to compile the CoffeeScript when the page is requested. Templating systems are also discussed in this chapter, and it's fascinating stuff. The chapter ends with a brief explanation of setting up a Node server on Heroku's Cedar stack.

              Overall, I'm very glad I read this book. I've read some great tech reference books, and I've read some awful ones – this book is definitely one of the better ones.

              I should disclose that I received a free e-book copy of this reference book from O'Reilly, in exchange for a review. I participate in the O'Reilly Blogger Review Program.

              (5 of 7 customers found this review helpful)

               
              4.0

              Sweet little book

              By sandyboy55

              from St. Louis, MO

              About Me Developer

              Verified Reviewer

              Pros

              • Accurate
              • Concise
              • Easy to understand
              • Helpful examples
              • Well-written

              Cons

              • Too basic

              Best Uses

              • Intermediate
              • Novice
              • Student

              Comments about oreilly The Little Book on CoffeeScript:

              Whether you love it or hate it, JavaScript is back with a louder than ever bang, thanks largely to HTML5. However, frameworks like JQuery provide concise syntax that eliminates the need to write buggy and verbose code. So why CoffeeScript? Curiosity led me to pick up this "little book". It turns out that CoffeeScript is a language that compiles down to JavaScript with a syntax inspired by Ruby and Python. In a little book of 6 chapters and 48 pages, Alex MacCaw cuts to the chase and explains the nuts and bolts of CoffeeScript neatly.

              In the first chapter, the author goes over the CoffeeScript syntax, variables, scope, functions, looping, flow control, etc - the usual, gentle, "hello world" type introduction. Things start getting interesting from chapter 2 as the book dives into CoffeeScript classes and goes into a little bit more detail into OO related topics pertaining to CoffeeScript. Chapter 3 covers CoffeeScript idioms like iterating over arrays, using Maps, select filtering, and other operations related to arrays. This chapter also covers how to use external libraries (like JQuery) which is extremely useful.

              Chapter 4 introduces the Cake (yummy!) build system to compile CoffeeScript. This is the best chapter in my opinion as it contains detailed information on how to maintain your code and not let it burgeon into sphagetti. I was delightfully surprised to see a section on deployment with Heroku. Chapter 5 guides you into avoiding pitfalls using CoffeeScript. This is really good to know as it will avoid hours of debugging later. Chapter 6 provides a conclusion about the intent and philosophy of CoffeeScript emphasizing that "It's Just JavaScript". The book invokes your curiosity to try out other compile-to-JavaScript languages on your own. The book will not make you an expert in CoffeeScript but does a great job of laying down a strong foundation.

              Displaying reviews 1-6

              Back to top

               
              Buy 2 Get 1 Free Free Shipping Guarantee
              Buying Options
              Immediate Access - Go Digital what's this?
              Ebook: $7.99
              Formats:  ePub, Mobi, PDF
              Print & Ebook: $9.89
              Print: $8.99

              Available in Multiple Languages