Smalltalk is Snakeoil

by moodyharsh

Smalltalk is Snake Oil

I invented the term ‘Object-Oriented’, and I can tell you I did not have C++ in mind - Alan Kay

The inventors of Simula and Sketchpad did not have Smalltalk in mind either. Combine the worst ideas from Sketchpad and Simula with universal pretensions of lisp and pay lip service to inheritance from biology, you get Smalltalk. If anyone wants to sell programmers bullshit they should learn from Alan Kay. He ripped off from Ivan Sutherland and Dan Engelbart. He talked about profound realisations and he has somehow managed to sell dictionaries to programmers as objects and iterating a dictionary as reflection.

In Lisp - everything is an s-expression. In Lisp you can interpret and modify the symbols used in s-expressions via macros, quote and eval aka symbolic programming. Smalltalk replaces lisp’s ideas with objects and reflection. S-expressions are linked lists and objects in smalltalk are closer to dictionaries in terms of querying capabilities. Once you have such an object - you can either evaluate it or query it or modify it, just like you can with s-expressions, without the code walking. In fact Lisp without code walking is Smalltalk. Ruby too without codewalking is equal to Lisp.

Are Lisp expressions really that universal ? I don’t buy into the whole Maxwell’s equations of software praise that Alan Kay showers on Lisp. Church Encoding although convenient does not represent a ground breaking view IMO. If Church Encoding and Decoding are like Maxwell’s equations then ELF object format or MP4 format must represent laws of thermodynamics or something. Objects are an ugly way to write s-expressions if you really squint. S-expressions are merely linked lists. This linked list supremacy is silly and childish beyond belief. Computer Science already has Maxwell’s equations in the works of Claude Shannon and Alan Turing. Shannon’s work maps electronic circuits with boolean logic. Turing Machine is far more fundamental because we have actually implemented it on real hardware. All Lisp machines were implemented on top stack machines as well, so which is more fundamental and universal ?

Reflection is the most useful idea from Smalltalk. This is simpler than code walking in macros. But reflection is not rocket science. You can implement your own object system with dictionaries and its probably much more flexible than what Lisp or Smalltalk could ever provide. Alan Kay has sold water to fish, dictionaries to programmers.

There is no debate there but the biggest problem with Smalltalk is the notion that inheritance promotes reuse and is a legitimate form of modelling. This wrong notion has crept into all of programming and is a prime example of defeasible reasoning. Simula promoted co-routines and events for modelling. Inheritance promotes action at a distance much more than reuse. super is a come from statement in disguise. Object oriented programmers don’t understand biology. If we are to believe object oriented modelling of the world - a unicorn inherits from a rhino and a horse. In reality you can’t make a unicorn by mating a horse with a rhino. And yet thats what OO programmers are doing all the time. Biology does not work like that. Even though all cells share the same DNA, a majority of the cell components are there to only selectively use the DNA. Sexual inheritance involves plenty of gene shuffling as opposed to blind inheritance. So why exactly do we use a biological terms to describe inheritance ? I think its the same way Deepak Chopra uses quantum theory to justify his non-sense. Alan Kay is biologist no less, shouldn’t he have known better unless he is a charlatan selling snake oil ? The notion that cells communicate by messages is an equally vague idea that does not hold ground on further inspection. What about salts in the cell ? What about epigenetic inheritance ? Analogies without grounding are fucking useless and fraudulent.

OO programmers then say this is not inheritance but taxonomy when they are caught red handed with their inheritance bullshit. But then taxonomy has nothing to do with behaviors but data modelling and we all know objects failed at data modelling. It is better to have explicit references like the Relational Model than Objects. Infact OO inheritance is closer to money inheritance. You should think of inheritance as a contract that states all changes made to A will be available to B if B inherits from A. Given that insanity, OO programmers talk of loose coupling in the same breath and they rewrite their code every time a new version of the same pointless framework releases while calling it code reuse. No wonder talking to OO programmers resembles talking to idiot lawyers. Here is a nitpick if you add 1 additional method or a parameter to any method, change the name of the class. In taxonomy if you change one small thing you get an entirely new species. A bird that swims in water becomes a frog, a different species.

The second failure of Smalltalk, promoting the use of closures which are half-actors rather than full blown actors. I think Smalltalk manges to do something useful because it has closures. Closures are a more useful construct than objects. They are especially needed for event handlers in UI. Although they can be used to implement actors with great difficulty, closures are not actors. This explains why javascript successful is useful in modern day programming.

One of the most telling moments In the 1962 Oscar-winning movie The Music Man is when the archetypal con man Harold Hill is confronted with the fact that he’s selling musical instruments even though he has no intention of teaching his would-be students how to use them. Hill, crestfallen, reveals the psychology of a successful con man: “I always believe that there’s a band, kid”.

Further Reading