[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: OO should break when broken(was re: the benefits of immutability)
On Monday, September 1, 2003, at 04:05 AM, Geoffrey Knauth wrote:
> This reminds me of something that bothers me about OO: the
> accumulation of unused stuff. When I extend Circle to make Ellipse, I
> add x-radius and y-radius, but the original radius instance variable
> is still there. Since I'm not going to use Circle's radius any more,
> I wish I could just ask it to go away, if the compiler or runtime
> could verify it isn't needed by methods I decide not to override.
If you are in this situation it means that you probably should have had
an abstract class which is a common ancestor of these two classes.
IIRC, the Sather language requires that all internal nodes of the class
tree are abstract. Only leaf classes can be instantiable classes. This
prevents you from making mistakes like the above.
--- james mccartney