Reflection on Smalltalk


I’ve started to learn Squeak and as a result Smalltalk sometime back and there is a feature in Smalltalk that I find absolutely amazing.

First of all, if you have heard of Smalltalk, what u’ve heard is probably the usual crap: Smalltalk is the grandfather of most modern OOprogramming languages. But believe me it’s more than that. First of all, grandfather would mean it’s old and near to death – it is old but certainly not dying. It’s not as big as Java is now but it is still well alive and it contains many nice things and what really got my attention is reflection
“In computer science reflection is the process by which a computer program of the appropriate type can be modified in the process of being executed, in a manner that depends on abstract features of its code and its runtime behavior.” – Wikipedia.

In Smalltalk, after you have created an object, you can modify the internal workings of that object’s class and the object remains alive. What more, it will even immediately react to the changes in its class and change its behaviour! This is something that neither Java nor my beloved C++ will do – simply amazing and imagine the consequnces: you have a big system to which thousands of people are connected and u need to patch it coz a major security issue has been discovered. Normally u’d have to log these users off, patch up and reopen everything but with a reflective programming language like Smalltalk, you can modify the code while all objects are alive without having any downtime!!! Awesome isn’t it.

Smalltalk is definitely worth investigating ifu have some time and going though Squeak for that is certainly a nice way to proceed.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s