Logo

1.3 Why Smalltalk

Moose is primarily a piece of software, and, as any piece of software, it is written in a particular programming language. In the case of Moose this language is Smalltalk. Smalltalk? Is this not this old language invented in the early 70s? Yes it is. Why is Moose implemented in Smalltalk? There are at least four distinct reasons.

First, Smalltalk comes with a built-in highly expressive query language. Any respectable analysis platform offers query facilities in some form. Typically, the query language is offered either as a custom language implemented by the platform, or in some external scripting language. In Smalltalk everything happens at runtime, including the compilation and the execution of code. Thus, Smalltalk already acts like a scripting language, which means that there is no need to implement yet another one. Add to it the collection hierarchy and smart traversals and you get a highly expressive query language.

Second, Smalltalk’s dynamic nature favors fast prototyping. Regardless of how uniform we think data might be, in reality it often presents particularities that are difficult to predict. These particularities require custom tools. Because in Smalltalk everything happens at runtime, we can always inspect objects, tweak existing tools, or even craft new ones on the fly.

Third, Smalltalk’s concise syntax allows for expressive abstractions and languages. Indeed, the complete Smalltalk syntax fits on a napkin. Furthermore, the syntax actually resembles a simplified English. For example, read the following code aloud:

aMooseModel allTypes reject: #isInterface.

Because the syntax is small, it allows us to bend it creatively. For example, try reading the following code aloud:

view nodes: (aMooseModel allTypes reject: #isInterface).
view edgesFrom: #superclass.
view treeLayout.

This code represents a simple Mondrian script to draw inheritance trees of all types from our model that are not interfaces. This small example illustrates the point in discussion: when used appropriately Smalltalk can be compact but still readable. You can get more details about scripting Mondrian in the dedicated chapter (Chapter 15).

Fourth, Smalltalk is plain beautiful. You might argue that it is a taste issue. I challenge you to give it a try. If you want a guide, I highly recommend the Pharo by Example open-source book available at http://www.pharobyexample.org/.

User Contributed Notes

tudor.girba (28 March 2010, 12:28 am)

Thanks.

nspies (26 March 2010, 12:58 am)

...Smalltalk? At least four distinct reasons.

--> Smalltalk? For at least four distinct reasons:

nspies (26 March 2010, 12:58 am)

...software, and as any piece of software it is written in a particular ...

--> software and, as with any piece of software, it is written in a particular ...

Add a Note