Going back to Smalltalk, it seems like original OO was prototypal. I wonder what made them change this.<p>Here's the article I was just looking at:<p><a href="http://onsmalltalk.com/objects-classes-and-constructors-smalltalk-style" rel="nofollow">http://onsmalltalk.com/objects-classes-and-constructors-smal...</a><p>Choice quotes<p><pre><code> But a constructor would really help pretty this up and encapsulate the knowledge about what fields are required for construction rather that forcing the client to individually initialize the object and hoping he does it correctly. So let's write a constructor for #Person, we'll put it on the "Person class", or the Person's class side as it'd normally be called.
Some Smalltalk'ers prefer to write their constructors in a different style, one that enforces encapsulation a bit more, by not allowing public setters for all the instance variables, like so...
Person class>>firstName: aFirstName lastName: aLastName
^(self new)
initializeFirstName: aFirstName lastName: aLastName;
yourself.
Person>>initializeFirstName: aFirstName lastName: aLastName
firstName := aFirstName.
lastName := aLastName.
relatives := Set new.
Smalltalk is not so much a language, as an extensible notation for creating languages. To rip off a famed martial artist, empty your mind, be formless, shapeless, like Smalltalk. If you put Smalltalk into a financial application, it becomes a custom finance language. You put Smalltalk into a shipping application, and it becomes a custom shipping language. Be Smalltalk my friend.</code></pre>