Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Douglas Crockford on coding standards

textarcana commented Nov 16, 2013

@ericnormand reminds me of my favorite line from JavaScript: the Good Parts (emphasis mine)

…avoid features that are often useful but occasionally hazardous. Such features are attractive nuisances.

I love this concept of attractive nuisances. Imho it is a metaphor that explains so much about what can go wrong when architecting a system :)


textarcana commented Nov 16, 2013

@hickerm it's really interesting how often readability comes up in the literature of software systems safety. For instance "comprehensibility and readability of code" comes up again and again in Gerard Holzmann's research on software safety at JPL/NASA. In "Powers of Ten" (PDF) he goes so far as to discourage basic practices like recursion, on the grounds that although recursion is useful in many contexts…

Without recursion… we are guaranteed to have an acyclic function call graph, which can be exploited by code analyzers, and can directly help to prove that all executions that should be bounded are in fact bounded…

Sounds eerily similar to Crockford's caution against "attractive nuisances" and the other passage pointed out by @ericnormand. I think there may be a common theme here: give up something useful in order to make static analysis easier, and the overall win may be large (at least when wins are measured in terms of overall system safety and reliability in the mid-to-long term).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment