Incase it doesn’t show up:

  • Zangoose@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    2 months ago

    The way I was taught was that you usually start off with only an interface and then implementing classes, and then once you have multiple similar implementations it could then make sense to move the common logic into an abstract class that doesn’t get exposed outside of the package

    • magic_lobster_party@fedia.io
      link
      fedilink
      arrow-up
      3
      arrow-down
      1
      ·
      2 months ago

      I usually break it out using composition if that’s ever needed. Either by wrapping around all the implementations, or as a separate component that is injected into each implementation.