Harmful Constructors

Posted by Kerry Mon, 25 Jun 2007 17:25:00 GMT

Gilad Bracha: So why not get rid of constructors and have a class declaration create a factory object instead? Well, Smalltalk did just that a generation ago. Every time you define a class, you define the factory object for its instances. I won’t explain the Smalltalk metaclass hierarchy here. Suffice to say that it is a thing of beauty, resolving a potential infinite regress with an elegant circularity.

This is a good article, and I’ve certainly hit the problems talked about with both Smalltalk and Java. I’m looking forward to some examples…