Daily Archives: 2007/08/18

Some things are different in Smalltalk

In many languages a variable is of some type. Sometimes you have to define the type when you set it or at least when you read it. In Smalltalk you dont redefine the type of a variable. Its always an object. So if you want to work with a value of some type you create an object and then send the value of the source objects as a message to the new object. And as this object has expects a value and handles the value, there is no process of redefining. One could say that this is redefining But its rather something like: A thermometer measures the temperature – you dont define that the number is a temperature – you send the value of the number (like 16) to a display object . And this display then works with that value. So I think this
is much easier for many reasons: You dont have to worry of which type a variable has – you just need to send its value and rather define inside the object how to check and work with that incoming values. So you concentrate on the objects rather then on the characteristics of variables, even if they are objects in languages other than Smalltalk.
Thats a very different approach. And I think even people who know what object oriented programming is are used to, like in Python work with types of variables.

Leave a comment

Filed under Programming