Course info
Sep 12, 2011
1h 59m

CoffeeScript is the little language that compiles to JavaScript. It is an attempt to expose the good parts of JavaScript in a simple way, combined with the best of Ruby and Python. This course introduces the CoffeeScript syntax and style. It explains the why and how of CoffeeScript development.

About the author
About the author

Liam is a software developer, technologist and product delivery expert. He thinks a lot about how to manage software delivery projects and how to grow high performance teams.

More from the author
React Fundamentals
4h 13m
Jun 21, 2018
F# Fundamentals
5h 40m
Mar 10, 2016
Backbone.js Fundamentals
4h 42m
Sep 5, 2012
Section Introduction Transcripts
Section Introduction Transcripts

What Is CoffeeScript?
Hello, I'm your host, Liam McLennan, and this is Introducing CoffeeScript. The first module of my course CoffeeScript Fundamentals. This course has been developed for web developers, in particular those web developers using the Microsoft family of tools, but we'll also briefly cover what it's like to use CoffeeScript on the UNIX-like platforms. We'll start with What is CoffeeScript? We'll talk a bit about CoffeeScript and how you can use it to help you on your projects. History won't take long because CoffeeScript is new, but there's value in knowing how it came to be. Syntax is where it really starts to get interesting because syntax is all that CoffeeScript is and it's where CoffeeScript shines. We'll take a look at how CoffeeScript works in particular the mechanics of how it does what it does. And also, a look at some of the alternative to CoffeeScript because CoffeeScript is not the only game in town and some of the competing projects may interest you as well. For the rest of this course, I'm going to assume a basic level of understanding of JavaScript, which is required to be able to use CoffeeScript effectively. If you are new to JavaScript, I highly recommend Pluralsight's excellent JavaScript Fundamentals course.

Why CoffeeScript?
Hm, why CoffeeScript? Well, CoffeeScript adds some nice features that JavaScript does not have. JavaScript is quite minimalist, which is great. But CoffeeScript adds a few things that are rather nice to have. They haven't gone silly adding every language feature and the kitchen sink. Each edition has been carefully considered and only included if the benefits outweigh the increase in cognitive load. This module will briefly introduce some of the features that CoffeeScript adds. Each of these will be dealt with in detail in later modules. CoffeeScript is pretty. Use it because it makes you happy. Books have been written about the flaws in JavaScript. CoffeeScript eliminates most of them.

Installing CoffeeScript
This module is all about configuring a development environment for working with CoffeeScript. What needs to be installed? The short answer to that question is nothing, since you can develop CoffeeScripts entirely in the browser. However there are some tools that will make your CoffeeScript work more enjoyable, such as a command line compiler. I assume most people watching this course use Windows for their development environment. This module will show one way to set up a nice environment for developing CoffeeScript on Windows. Keep in mind that it is just one possible setup of many, and that CoffeeScript tooling is evolving rapidly. By the time you've finished watching this module, there will probably be scores of new options. After I've got my Windows environment set up, I'll demonstrate how to create a CoffeeScript environment on a Unix-like system. I'll be using Linux, but the steps required are very similar for OS X. If you don't use Linux or OS X, feel free to skip this part.

Working With CoffeeScript
Some like to talk about their lexes and pauses. Some like to stare at their Backus-Naur Form. But this course is not a theoretical contemplation of the abstract. This course is about the application of a programming language. It's about getting started writing code and solving problems with CoffeeScript. And that's what we will do in this module. I will introduce a simple JavaScript program, and then convert it to CoffeeScript to highlight some of the differences between the two languages. And I'll end the module by demonstrating the writing of a simple CoffeeScript program.

Language Elements
This module is a whirlwind tour of CoffeeScript language features. I will cover comments, declaring variables, and assigning values to them, destructuring assignment which lets us assign multiple variables at one, blocks, conditionals, the ternary if operator, chained comparisons, loops, and logical operators.

Data Types
CoffeeScript comes with access to all of JavaScript's built-in types, often simplifying them or extending them. This module covers strings, including interpolation, multiline strings, and heredocs; numbers; ranges; arrays, including array slicing and array splicing; regular expressions and heregexs; function, definition, invocation, default arguments, and function binding; object literals and the CoffeeScript syntax for that; and finally classes, CoffeeScript class syntax, constructors, instantiating objects from classes, inheritance and static properties.