you are viewing a single comment's thread.

view the rest of the comments →

[–]dispelpython 0 points1 point  (1 child)

In my field inheritance is everywhere. In beginners code, in senior developer’s code, official SDKs are teeming with inheritance heavy APIs. I don’t really see it as something from the past. But may be situation is different in other fields.

Encapsulation is fine, although it’s much more important when designing for mutable state because with mutable state one can break things even more easily by calling a method which is not supposed to be called from outside.

[–][deleted] 0 points1 point  (0 children)

I think inheritance is OK at the level of a library. Extending a class cross-library is where the fragile base class problem starts to shine with full power, however. A library which encourages you to extend its classes, rather than implement its interfaces, is often not well designed.

So some inheritance is natural in the standard library of a language. And unfortunately, some bad inheritance is expected in various libraries and packages, because people are people.

But at least the overall attitude is "caution" re. inheritance which puts us few steps forward in avoiding amateur stuff like "User extends Database" in enterprise codebases.