-
Book Overview & Buying
-
Table Of Contents
Coffeescript Application Development Cookbook
By :
We are living in a time where JavaScript is becoming the most widely-used programming language in the world, even though it is not a language without its faults.
With its rise in popularity, JavaScript has become a legitimate option to develop all aspects of modern applications, applications that comprise a rich HTML/CSS/JavaScript client that communicates with backend services via AJAX. These applications can be run on desktops and mobile platforms as websites, mobile web, or hybrid applications using a native wrapper such as Apache Cordova / Adobe PhoneGap.
Node.js has helped JavaScript reach well beyond the boundaries of the web browser and into our operating systems themselves.
You might be surprised to know that Microsoft Windows has shipped with a JavaScript execution engine called Windows Script Host since Windows 98.
JavaScript, though very successful, can be a difficult language to work with. JavaScript was designed by Brendan Eich in a mere 10 days in 1995 while working at Netscape. As a result, some might claim that JavaScript is not as well rounded as some other languages, a point well illustrated by Douglas Crockford in his book titled JavaScript: The Good Parts, O'Reilly Media.
These pitfalls found in the JavaScript language led Jeremy Ashkenas to create CoffeeScript, a language that attempts to expose the good parts of JavaScript in a simple way. CoffeeScript compiles into JavaScript and helps us avoid the bad parts of JavaScript.
There are many reasons to use CoffeeScript as your development language of choice. Some of these reasons include:
this keywordAs Jeremy Ashkenas says:
"CoffeeScript is just JavaScript."
We can use CoffeeScript when working with the large ecosystem of JavaScript libraries and frameworks on all aspects of our applications, including those listed in the following table:
|
Part |
Some options |
|---|---|
|
User interfaces |
UI frameworks including jQuery, Backbone.js, AngularJS, and Kendo UI |
|
Databases |
Node.js drivers to access SQLite, Redis, MongoDB, and CouchDB |
|
Internal/external services |
Node.js with Node Package Manager (NPM) packages to create internal services and interfacing with external services |
|
Testing |
Unit and end-to-end testing with Jasmine, Qunit, integration testing with Zombie, and mocking with Persona |
|
Hosting |
Easy API and application hosting with Heroku and Windows Azure |
|
Tooling |
Create scripts to automate routine tasks and using Grunt |
We will look at each of these in depth throughout this book.
Change the font size
Change margin width
Change background colour