Smalltalk vs JavaScript

It used to be that Smalltalk’s competition came from Java and Ruby. Java, because it took away Smalltalk’s future by being free and freely available from Sun Microsystems. And Ruby, because it borrowed some of Smalltalk’s qualities while still remaining a file-based language (arguably, Ruby is missing Smalltalk’s best feature of live coding and debugging) and being easy to learn. Moreover, were it not for Ruby on Rails, Ruby probably wouldn’t have achieved the success it enjoys today.

Recently, however, another contender has risen to pose an even greater challenge to Smalltalk: JavaScript. JavaScript is rapidly becoming the universal programming language, thanks to its ubiquity in the web browser and its vast ecosystem that stretches to the horizon. JavaScript is used nearly everywhere, from web apps to mobile apps, to games and graphics, to embedded devices, to server-side applications, even to desktop applications. All this despite JavaScript’s reputation as being one of the worst programming languages ever created, despite its programming minefield, despite the lack of proper JavaScript training in school and industry (so that most JavaScript developers abuse the language).

Fortunately, Smalltalk and JavaScript can coexist very nicely, thanks to Amber and the upcoming PharoJS project. Smalltalk offers several enormous benefits…

First is Smalltalk’s impossibly clean syntax. JavaScript has many syntactical issues and semantical “gotchas.” Smalltalk is very pleasant to learn and easy to master. It’s also worth noting that with ES6 and ES7, JavaScript is becoming ever more complex as a language (the language spec for ES6 is 545 pages long!!!).

[Have a look at how elegant Pharo code can be here. It’s unbelievable!]

Second is Smalltalk’s IDE which allows for live coding and debugging, although to be fair, a similar environment called the Lively Kernel exists for JavaScript. However, there’s no denying that the Pharo IDE is far more mature and evolved. Also, keep an eye on the Glamorous Toolkit from Moose Technology.

Third is Smalltalk’s consistent and pure object model [1]. JavaScript is a hybrid (bastard?) language that supports conventional imperative programming, as well as object orientation (through prototypal inheritance) and functional-style programming. This can make an application appear messier. Smalltalk is always clean and pure as the driven snow.

The unique combination of all these things creates a synergy not seen anywhere else in the IT world. This synergy greatly amplifies productivity [2] and makes programming much more intuitive.

There’s no good reason to program directly in JavaScript, and plenty of good reasons to use a JavaScript “transpiler” like Amber instead.