Created: 2012-03-23 14:17
Updated: 2016-10-16 21:22

A retelling of Anders Janmyr's "Braceless Programming".

Includes bonus "Object Oriented" implementation, and implementations in CoffeeScript.

Requires node.js, and coffee-script will be installed in this directory for you.


Clone this repo, then run make. All the 'tests' should SUCCEED.

coding style

I left the feedAnimals() function in the style of the author, but the new code I wrote is in my own style. Four space indent, lots of whitespace, separator comments before functions/methods. The separator comments are clearly overkill, as is not single-lining some of the functions/methods, but in "real life" my code tends to be more complex.

I tended to go "Object Oriented" as I do in real life.


The first example from the blog post.


The second example from the blog post.


Another example, this one assuming animals know what food they eat, by using a new top-level function prepareFood(animal).

CoffeeScript version of animals-1.js.

CoffeeScript version of animals-2.js.

CoffeeScript version of animals-3.js.

Cookies help us deliver our services. By using our services, you agree to our use of cookies Learn more