3 ms·
These examples are supposed to be examples, not what we would actually do in this specific case. In a huge enterprise system that has 500 different ways somethi
by jryan49 8y ago
These examples are supposed to be examples, not what we would actually do in this specific case. In a huge enterprise system that has 500 different ways something could be done, in which your function would have 30 million if statements, all which is dependent on runtime behavior, polymorphism can help solve that problem.
Imagine there are hundreds of ways Hit can be implemented and used in different situations. That's the reason for breaking out this type of abstraction. I agree this example the author used isn't probably a clear one in which one should use OOP.
- jstimpfle 8y ago> Imagine there are hundreds of ways Hit can be implemented and used in different situations. This is the typical argument you get to hear from OOP apologetists. And the codebase is rotting, just for concerns about hypothetical problems... I remember one time when I was criticized for putting in too much global data and not enough classes "because what if we have two GUI instances?". The guy of course had no idea why he would want that, and how it should work.