Douglas Crockford




Cloud Expo

2019 Appearances






How JavaScript Works

Fun With Functions

One of the greatest obstacles to technical progress is the paradigm barrier. In this context, a new paradigm is a good idea that is difficult to distinguish from a bad idea. In programming history we have seen many paradigms that became accepted only after the first generation to encounter it retired or died. This has included high level languages and structured programming.

We should be advancing more quickly on functional programming and higher order functions. The difficulty is that innovations like this require a paradigm shift. The new paradigm must be experienced. Hearing or reading about it is not sufficient. Arguments will not be persuasive. We may think we understand the new paradigm, but we probably don't.

Note that this is very different than fads, where we might feel inclined to believe something that turns out to be a bad idea. Popularity is not a reliable determiner of truth.

I developed a one day workshop called Fun With Functions that helps students thru the paradigm shift by having them solve a series of simple problems. By the end of the day, they should have experienced enough of functional programming to understand the argument. My model was The Little Schemer, a delightful book that does a similar thing for recursive functions.

I have done this workshop all over the world. It was the inspiration for Chapter 13 of How JavaScript Works. Everytime I performed it, I made adjustments and improvements. I am pretty happy with its current state. 

So I am releasing the PowerPoint slides that include all of the problems. The slides do not include my snappy patter, so they do not provide the complete experience, but most of the material stands on its own.

The final two problems are security exercises that were suggested by Mark Miller. Yes, that Mark Miller. The answers contain security vulnerabilities. You need to find exploits and mitigations. The final mitigation reveals another vulnerability in the setTimeout function. We'll solve that one another time.

All of the JavaScript code is displayed with context coloring.