This essay says that inheritance is harmful and if possible you should “ban inheritance completely”. You see these arguments a lot, as well as things like “prefer composition to inheritance”. A lot of these arguments argue that in practice inheritance has problems. But they don’t preclude inheritance working in another context, maybe with a better language syntax. And it doesn’t explain why inheritance became so popular in the first place. I want to explore what’s fundamentally challenging about inheritance and why we all use it anyway.

  • onlinepersona@programming.dev
    link
    fedilink
    English
    arrow-up
    1
    ·
    8 months ago

    Saying “X is bad” or “Y over X” is not the same as saying “there is never a place for X”.

    That rarely comes across online where opinions are often stated dichotomously. Especially when speaking of inheritance, some crowds (I’ve noticed this in the Rust crowd) are vehemently against it and will do nigh anything not to think of a problem as one of inheritance nor a solution that could benefit from inheritance. The makers of the servo browser engine which has to implement hierarchical structures (the DOM) ran against this exact issue within the Rust community where inheritance might as well equate to blasphemy.

    I recognise that it’s probably a loud, zealous minority, but it makes interacting with the rest of the community rather difficult.

    Anti Commercial-AI license