Topic 31 | Inheritance Tax |
You wanted a banana but what you got was a gorilla holding the banana and the entire jungle.
Do you program in an object-oriented language? Do you use inheritance?
If so, stop! It probably isn't what you want to do.
Let's see why.
Some Background
Inheritance first appeared in Simula 67 in 1969. It was an elegant solution to the problem of queuing multiple types of events on the same list. The Simula approach was to use something called prefix classes. You could write something like this:
| link CLASS car; |
| ... implementation of car |
| |
| link CLASS bicycle; |
| ... implementation of bicycle |
The link is a prefix class that adds the functionality of linked lists. This lets you add both cars and bicycles to the ...
Get The Pragmatic Programmer: your journey to mastery, 20th Anniversary Edition, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.