in reply to Re: The Accessor Heresy
in thread The Accessor Heresy
Really? That doesn't seem to be my experience...
Off the top of my head:
Graphics: Square isa Rectangle isa Polygon Line isa Curve Circle isa Elipse isa Curve
Data Types: PrimeNumber isa Unsigned Int isa Int isa Real isa Complex String isa ArrayOfObjectTypeCharacters
Unix I/O: TTY isa CharacterDevice isa IODevice isa FileIOObject (TTY is much simpler than generic character devices, and character devices are much simpler than generic I/O devices. FileIOObjects are a simpler abstraction, however...)
In general, I find that base classes are usually often more general (and more complex) than specializations, since the point of a generalization is to encompass a wider number of possibilities. General algorithms are more abstract, but specific algorithms tend to more efficient. For example, it takes only two points to specify a line; but an infinite number of points are required to specify a general abstract curve. If you use a Curve object where a Line would do, you've used infinitely more storage space than necessary. ;-)
I've never been a fan of OO, largely because of code like this:
@abc=$x->$y(@z);
It's now so abstract that the code doesn't actually tell me what method is being called, what class that method comes from, and what data is being passed into the (unknown) method. It's all decided at run time; so the only way to know what it will do is to run it, and see what data is reaching that section of the code. That's no fun.
--
Ytrew Q. Uiop
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: The Accessor Heresy
by dragonchild (Archbishop) on Nov 28, 2005 at 19:02 UTC | |
by Anonymous Monk on Nov 28, 2005 at 21:30 UTC |