Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> no one ever brought up "inheritance as reuse" in this thread, don't straw man.

Yes they did. I quote one of the statements at the top of this thread:

> But in real life, when there is a team, you run into the fragile base class [1] constantly and changing that base class causes horrible issues across your code base.

The "fragile base class" is one of the problems of "inheritance as reuse". It simply doesn't occur with interface inheritance (the other common type of OOP inheritance).

> It's called OOP, NONE of those letters stands for "inheritance"

That line of conversation is fruitless. We're discussing OOP as practiced, not as defined by Alan Kay (who came to regret the name "OOP" anyway).

OOP as practiced is all about inheritance, and sadly, its pitfalls. This is exactly what other people in this thread are discussing pros and cons of! Not OOP in academia, but in practice.

Also, it's mentioned in the article which you hopefully have read:

    In this post I use the word “OOP” to mean programming in statically-typed language with:
    
    - Classes, that combine state and methods that can modify the state.
    - Inheritance, which allows classes to reuse state and methods of other classes.
    - Subtyping, where if a type B implements the public interface of type A, values of type B can be passed as A.
    - Virtual calls, where receiver class of a method call is not determined by the static type of the receiver but it’s runtime type.


> Tight coupling is the basis of oop. A method is tied to an instance. Methods cannot be composed with other methods or functions without instantiating state. Methods cannot be moved into other scope.

> The literal definition of an object is a tightly bound set of methods that cannot ever be used without instantiating state.

That is the nonsensical point I responded too, you're bringing up an actual bigger debate that's out of scope.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: