2 ms·
That is exactly what I said you could say: > You could say that I just did not do it right, but that is the problem. You need to know precisely what the future
by ryao 2y ago
That is exactly what I said you could say:
> You could say that I just did not do it right, but that is the problem. You need to know precisely what the future will want to do it right and that is never possible to know in advance.
Every time inheritance causes a headache, you can call it a misuse of inheritance, but that is only obvious after you have been to the future.
- carmackfan 2y agoYou don't need to precisely know about the future to know that inheritance isn't for sharing behavior. Unfortunate it's not really taught properly.
- ryao 2y agoThat is easy to say in hindsight when given the example. It is not so easy to see in advance. After all, OOP’s proponents say that OOP makes everything better. You never hear them saying “don’t use OOP here”. https://duckduckgo.com/?q=oop+inheritance+behavior https://duckduckgo.com/?q=oop+inheritance+behavior I doubt you would find a single result in the top 10 saying not to do this and many will seem to encourage it. One of the results says: > Inheritance is frequently used to integrate your code with library code A much younger version of myself said: Daemonizing should be a library function. Let’s use inheritance to do that. Saying it is not really taught properly is avoiding the reality that you just can’t teach it properly. Knowing for certain when it will not cause problems requires knowing the future.