Why Smalltalk?
The inevitable question, while writing a series of posts on Smalltalk.
“Why Smalltalk?”.
21 years ago, this wasn’t much of a question, Smalltalk was “old” then, as far as programming languages go, but it was actively developed, IBM had a Smalltalk 1, and with the burgeoning XP movement (which sprung from a project written in Smalltalk 2), Smalltalk was definitely more popular, only 3 years earlier, Java was first publicly released (1995).
Indeed, the original Design Patterns book has examples in C++ and Smalltalk, and was published in 1994 (the year before Java).
In 2019 tho’, those days are gone, GitHub has hundreds of programming languages, if not thousands, it’s interesting to note that more than 50% of the World’s population speak just 23 languages 3 nowadays, and after that there’s a long tail, our programming language usage 4 is probably similar.
Clearly nowadays, Smalltalk is mostly a relic, it was invented by Alan Kay, who is regarded as “one of the fathers of the idea of object-oriented programming” 5, so if you want to see what a pure OO language looks like, Smalltalk is definitely a good option.
Many of the patterns we see in more modern languages are derived from Smalltalk, especially the Collection 6 protocols would be easily recognisable to anybody familiar with modern Java, Rust, Clojure, Erlang, Ruby, Kotlin etc:
To quote from the Smalltalk-80 “Blue Book” 7.
do: aBlock
Evaluate the argument, aBlock, for each of the receiver’s elements.select: aBlock
Evaluate the argument, aBlock, for each of the receiver’s elements. Collect into a new collection like that of the receiver, only those elements for which aBlock evaluates to true. Answer the new collection.reject: aBlock
Evaluate the argument, aBlock, for each of the receiver’s elements. Collect into a new collection like that of the receiver only those elements for which aBlock evaluates to false. Answer the new collection.collect: aBlock
Evaluate the argument, aBlock, for each of the receiver’s elements. Answer a new collection like that of the receiver containing the values returned by the block on each evaluation.
While some of these have been renamed, these should all be recognisable.
Smalltalk is as much an IDE, as a Language, which may have been part of the reason for adoption falling off, the Smalltalk Image has live objects “running”, the UI has instantiations of classes that are defined within itself, this is amazingly flexible, but it can also lead to unfamiliarity, also a lot of standard tooling (git for example), doesn’t really play nicely with Smalltalk, most Smalltalks came with versioning of changes in the IDE, and there are repository systems for Smalltalk, but these were not, 20 years ago, using industry standards.
So, to answer the question, is Smalltalk more than an intellectual curiosity? Sadly probably not, but, like learning any programming language, it can change how you think about things in your language of choice.
Smalltalk standard libraries were often written by folks who really understood OO, the small methods, “intention revealing selectors” as they’re called, make for easy to read code, which in turn should influence your own programming.
Of course, I can’t write about Smalltalk without mentioning two of my favourite books, “Smalltalk Best Practice Patterns” 8 and “Kent Beck’s Guide to Better Smalltalk” 9 which, while written about Smalltalk, have insights that will improve programming in any language.
The former is full of great advice in small snippets, and the latter is a collection of articles written by Kent Beck for a magazine, with a lot of interesting tips.
Should you learn Smalltalk for commercial reasons? No, I don’t think it’s gonna make a comeback.
Will learning Smalltalk improve the way you write other languages? Definitely yes!
-
IBM VisualAge is now https://www.instantiations.com/products/vasmalltalk/index.html, their VisualAge for Java environment was an early Java IDE, and written in Smalltalk. ↩
-
https://en.wikipedia.org/wiki/Chrysler_Comprehensive_Compensation_System or https://www.martinfowler.com/bliki/C3.html ↩
-
https://www.ethnologue.com/guides/how-many-languages ↩
-
https://www.benfrederickson.com/ranking-programming-languages-by-github-users/ ↩
-
https://en.wikipedia.org/wiki/Alan_Kay ↩
-
http://www.cs.williams.edu/~dbarowy/cs334s18/assets/p1-cook.pdf ↩
-
http://stephane.ducasse.free.fr/FreeBooks/BlueBook/Bluebook.pdf ↩
-
http://www.informit.com/store/smalltalk-best-practice-patterns-9780132852128 ↩
-
https://www.cambridge.org/core/books/kent-becks-guide-to-better-smalltalk/D849CEA80CF54A2D6DDC720A472E3650 ↩