CoffeeScript is an expressive alternative to JavaScript that has gained popularity among some developers, and since CoffeeScript compiles to JavaScript it can be used anywhere JavaScript can be used.
However like any new technology, there are human factors to consider when you introduce CoffeeScript to an organization. Once a project team has decided they would like to use CoffeeScript in an organization where it’s not already in use it is advisable—possibly required—to get buy-in from decision makers. Being prepared to make your strongest case for CoffeeScript adoption will maximize your chances of getting a “Yes!”
CoffeeScript at Atomic
At Atomic Object, CoffeeScript is an important component of many projects, but the decision to use it is not something we dictate. Our client’s requirements often specify which technologies to use on a project. These requirements are the product of our Research, Design, and Planning process that includes consideration for our client’s existing technology stack and who will be supporting the software after delivery.
We often recommend CoffeeScript because we think it allows us to deliver more value to our customers. Our projects are usually fixed budget, but the project scope evolves with the continuous feedback we seek from the client. CoffeeScript facilitates faster development, and because it automatically handles a number of JavaScript’s deficiencies, it allows us to focus on the problem domain. This means in order to maximize the value we deliver to the client, we need to be prepared to make our strongest case to the client.
Bringing CoffeeScript to Your Project
Here are some tips on advocating CoffeeScript adoption:
- Your target audience may not be technical or care about specific features of the language. Instead, emphasize that CoffeeScript allows you to deliver more features, in less time, and with higher quality.
- If your audience is highly technical, they still may not care about CoffeeScript’s syntax, which allows you to write less code than JavaScript. Instead, focus on some of CoffeeScript’s more advanced features. As an example, demonstrate how easy CoffeeScript makes it to use function composition to build complex functions from simpler parts.
- Give some examples of projects that are using CoffeeScript. For example, Atom, the code editor by GitHub, is implemented in CoffeeScript
Responding to Questions & Objections
When recommending CoffeeScript to your organization, there will be questions and concerns. It’s common for people to respond to new ideas with apprehension or even aggression. How you react can turn your conversation into a confrontation or make the other party feel safe to continue the discussion with an open mind.
“When it’s safe, you can say anything. Here’s why gifted communicators keep a close eye on safety. Dialogue calls for the free flow of meaning—period. And nothing kills the flow of meaning like fear. When you fear that people aren’t buying into your ideas, you start pushing too hard. When you fear that you may be harmed in some way, you start withdrawing and hiding. Both these reactions—to fight and to take flight—are motivated by the same emotion: fear. On the other hand, if you make it safe enough, you can talk about almost anything and people will listen. If you don’t fear that you’re being attacked or humiliated, you yourself can hear almost anything and not become defensive.” — Crucial Conversations, Chapter 4
It’s important to acknowledge as legitimate any concerns that are expressed.
- When a new technology is considered for adoption in an organization, it’s common for managers to be concerned that the organization will become dependent on one or a few individuals who understand that technology. Explain that the basics of CoffeeScript can be picked up by an experienced JavaScript developer in a few hours.
- CoffeeScript code is converted to JavaScript, which runs in the browser. There may be concern that debugging the JavaScript will be difficult, since the user doing the debugging has to mentally map lines of JavaScript back to the original CoffeeScript. In practice the JavaScript code is very readable. Also modern browsers now support source maps, which allow you to view the original CoffeeScript code in the debugger.
- If your audience has done some research, they will have read that CoffeeScript has its own flaws. Acknowledge that CoffeeScript is not perfect but that its quirks are pretty easy to avoid and are out-weighed by its benefits.
CoffeeScript Development, Javascript Output
If you experience significant resistance to CoffeeScript, there is a potential compromise to be made. Allowing developers to use the tools they are most comfortable with helps them to produce their best work. As stated earlier, CoffeeScript compiles to JavaScript and the resulting JavaScript is very readable. This opens up the possibility that the project can be developed using CoffeeScript, and the JavaScript output can be delivered with the rest of the project artifacts.
Dealing with “No”
On a reasonably-sized project, there will be any number of decisions to be made that will require debate and compromise. Despite your persuasive arguments, the organization may reasonably decide it is in their best interest to use JavaScript. One mark of a good developer is how we respond when we don’t get what we want. As much as we might like CoffeeScript, being required to use JavaScript is not the end of the world. Accepting the decision to use JavaScript with humility and grace should earn you some respect and also capital that may be needed to influence more important decisions.