Skip to content

Inheritance is (not) for code reuse #14

@edbennett

Description

@edbennett

Currently we mention at the top of episode 3 that we can reduce code duplication between different similar classes by using inheritance. This is probably upsetting to a lot of OOP folks who maintain that inheritance is vehemently not to avoid duplication/allow reuse of code, but instead to express relationships between classes of object.

While I don't want to take sides in a religious war, certainly thinking about inheritance that way can lead to unhelpful thought patterns (like whenever you want to reuse code, you should use inheritance, even if the classes are completely unrelated). It would be good to rephrase this section to better convey the patterns where inheritance is and isn't a good idea.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions