OOP



This is re-post from another forum where it haven't received much
response (plus I am banned from there, so I can't continue it :)

I would like more comments on this stuff.

----------------------------------------------------------------
(blah blah blah omitted)
Human mind has this property: it finds similar patterns in different
things, A and B, and forms an abstraction - abstract concept C. Key
thing is that within C things A and B cannot be distinguished - they
become "same" (vs "different" in the beginning of this paragraph :)

Back to OOP tale, when programs became larger, lazy programmers found
that different classes were not that different - there were similar
"patterns" in data flow, code logic and layout. So they plagiarized
that trick of our brain, and created "inheritance" - a mechanism
allowing one class to "borrow" code from another (as a side effect,
objects of different classes, casted to parent class, can't be
distinguished). In the end, most abstract classes now contain code so
basic and simple that they are virtually useless by itself.

Now, to the point. Architect 1 (a guy who tells stupid programmers what
their code should look like) comes up with this:

- there will be seven classes;
- classes 1 and 2 will be abstract;
- classes 3, 4 and 5 will inherit code from class 1;
- classes 6 and 7 - from class 2.

Everything seems ok, and stupid guys start to code classes 1 and 2. All
of sudden, after this part is nearly done, architect 2 comes to
architect 1 and says:

"I reviewed proposed architecture, and found many similar code in
classes 3..5 and 7, so we should pull it out to classes 1 and 2. Hell,
let's have another even more abstract class 0, which is what classes 1
and 2 will inherit code from. This will save us some coding time
later."

Architect 1 replies:

"Brilliant, wish you could point out this before, wait I'll tell stupid
guys"

Then, they make stupid guys happy, and after they leave the room,
stupid guys say:

"@$ $@%^ @(&^*# @&%^~ !!! WTF? I have to threw out half of code I
already wrote!"

....

The point is that while human brain have no problems making more and
more abstract concepts (that is, works in bottom-up direction),
software is written in top-down direction, and adding new level of
abstraction in the middle of the project is quite painfull.

A question to coders is, of course, what are you doing about it; but
it's rather question to philosophers, what CAN BE done about it, in
principle?
----------------------------------------------------------------

.



Relevant Pages