Even people who understand prototypal inheritance do not like it. Here’s an inconvenient truth…

The notion of object prototypes has been around for at least 29 years, since the Self language was created. In the past quarter century, no new language of note has adopted object prototypes, unless you want to include 23-year-old Lua. All of the latest OOP languages, such as Dart, Scala, Groovy and Swift, have eschewed object prototypes. If this feature was so powerful and useful, why has it been roundly ignored?

If prototypal inheritance was truly as useful as you all claim, then it would’ve been at least adopted as a programming pattern in normal OOP languages. Just as class-based OOP can be simulated in JavaScript (ES6), the reverse is true: object prototypes and prototypal inheritance can be simulated in Java, C# and Smalltalk.

The people who design languages typically know all about object prototypes. They aren’t ignorant. They do not “misunderstand” prototypes. They simply don’t think it’s worth adopting.

And neither do I.

Object Prototypes Do Not Scale Well

Languages like Smalltalk and C++ are capable of writing programs as big as a million lines of code. JavaScript would be hopeless in these situations. While classes do have their problems, there is (currently) no better way to organize large-scale application code.

I get that object prototypes make JavaScript feel like a light, fun, productive programming language. And as long as the language is also suitable for proper software engineering, I have no problem with that. Unfortunately, that isn’t the case.

Smalltalk is also a light, fun, productive programming language. In fact, it’s the most productive programming language in the world!

It’s a beautifully simple and elegant language that is really, really easy to learn. In fact, Smalltalk has virtually no syntax at all! Smalltalk syntax comes down entirely to sending messages to objects: <object> <message>, where <message> can be unary, binary (infix), or keyword (taking on a parameter). That’s it! All the rest of Smalltalk is in its rich class library. This includes conditionals and loops and unbelievable extensibility.

With its first-class functions and closures, Smalltalk can do anything that JavaScript can do. It is one of the most powerful programming languages in the world, so powerful, in fact, that it has been used to write a million-line battle simulation program for the U.S. joint military called JWARS.

So powerful, in fact, that Smalltalk almost became the dominant enterprise language in the past 20 years. In the early 1990s, IBM selected Smalltalk as the centrepiece of their VisualAge enterprise initiative (until Java usurped this role). We came this close!

The best thing about Smalltalk is probably its “live” programming environment/IDE/debugger. It is second to none. In conjunction with its light syntax, this is what explains Smalltalk’s incredible productivity.

And guess what? You can use Smalltalk for writing web applications! Amber Smalltalk transpiles to pure JavaScript which can be deployed on any web server with ridiculous ease. You only need to know enough JavaScript to interface with jQuery and then you can generally ignore this dysfunctional programming language.

Moreover, when you import JavaScript libraries, their objects can be treated just like Smalltalk objects! How frickin’ cool is that?!

Bottom line: Forget JavaScript! Use Smalltalk instead. Get with the program!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store