CHAPTER 8

Debugging CoffeeScript

No matter how expert the programmer, some system debugging is always necessary. Developers just learning often fall back onto “printing” output to the console. Although this works and gives insight into the inner workings of the code, it doesn’t scale very far or last very long.

As the sophistication of the code grows, so does the sophistication of the bugs; in fact, they tend to stay one or two steps ahead. What you need are better tools, and with the browser environment currently being one of the most popular development platforms, the tools are in abundance. Most developers will be in the enviable position of choosing those things that meet their needs best, feel most comfortable, and allow them to be their most productive.

This chapter covers a variety of tools that can be used to inspect a CoffeeScript program when it’s running. There are a number of ways of attempting to detect and prevent bugs, but sometimes the easiest way forward is to watch what a program does and whether or not it is behaving in the way expected. This is a slightly more involved process with CoffeeScript because it’s a compiled language, which is unusual for the web. You’ll be pleased to see, though, that many familiar tools can be used, and we’ll also explore some of the new features browsers support to make debugging even more efficient.

Writing reliable software

There are many tools available to developers who want to create reliable software. Using test frameworks, ...

Get Smashing CoffeeScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.