Skip to content

Instantly share code, notes, and snippets.

@textarcana
Last active January 20, 2020 13:31
Show Gist options
  • Save textarcana/1745829 to your computer and use it in GitHub Desktop.
Save textarcana/1745829 to your computer and use it in GitHub Desktop.
Douglas Crockford on coding standards
@textarcana
Copy link
Author

@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
Copy link
Author

@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