• bradboimler@lemmy.world
    link
    fedilink
    English
    arrow-up
    12
    ·
    16 days ago

    I write my code for future maintainers. I optimize for clarity, testability, and readability.

    I’ve become a huge fan of dependency injection. That does not mean I like DI frameworks (Guice). I tend to do it manually with regular code.

    When I maintain code and I sit there wondering what it actually does, I write a unit test for it right then and there

    And so on

    • sip
      link
      fedilink
      arrow-up
      3
      ·
      16 days ago

      DI without a tool/injector is just composition. just saying

      • nebeker
        link
        fedilink
        English
        arrow-up
        2
        ·
        15 days ago

        A good reminder that composition is a useful concept.

        • sip
          link
          fedilink
          arrow-up
          2
          ·
          14 days ago

          it’s my fav and it’s easy. allows containing details of a lower lever gizmo in a higher level thingamabob and basically free strategy pattern, especially if you use DI… and allows mock/spy testing!