Monday, December 17, 2012
Steve Yegge Notes from the Mystery Machine Bus
Assembly language: Batshit liberal.
Perl, Ruby, PHP, shell-script: Extremist liberal.
Python, Common Lisp, Smalltalk/Squeak: Liberal.
C, Objective-C, Scheme: Moderate-liberal.
C++, Java, C#, D, Go: Moderate-conservative.
Clojure, Erlang, Pascal: Conservative.
Scala, Ada, OCaml, Eiffel: Hardcore conservative.
Haskell, SML: Extremist conservative.
As much as some commenters are (weirdly?) railing against this classification scheme I think the underlying idea that software conservatism is about risk aversion is essentially accurate.
Perhaps another way of framing this is to ask the question: are you optimizing for the best case or the worst case? This ultimately is a form of risk management. And I'm not talking in the algorithmic sense, meaning complexity expressed as the asymptotically worst case. I'm talking about people, software and ecosystems.
Let me illustrate this idea with Java.
- C++ has operator overloads. Java does not? Why? Because people might abuse them. That's optimizing for the worst case (ie bad or inexperienced programmers). Properly used, operator overloading can lead to extremely readable code;
- Java has checked exceptions and uses them liberally (pun intended). C#, as one example, only has unchecked exceptions. Why? Philosophically the Java language designers (and many of its users) feel that this forces callers to deal with exceptions. Pragmatically (IMHO) it does not and leads to more cases of exceptions being simply swallowed. But again this is optimizing for the worst case ie programmers who should deal with a particular error condition but won't;
- Java has no multiple inheritance. Same story: it can be abused ("it is known"). But also mixins can be a powerful metaphor.
- Rinse and repeat for duck typing, extension methods, etc.
Putting Python two steps from Ruby strikes me as an interesting choice. I'd say the difference is at most one.