• Kache@lemm.ee
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    23 days ago

    Sounds easy to simplify:

    Use one of: constructor A(d), function a(d), or method d.a() to construct A’s.

    B and C never change, so I invoke YAGNI and hardcode them in this one and only place, abstracting them away entirely.

    No factories, no dependency injection frameworks.

    • GissaMittJobb@lemmy.ml
      link
      fedilink
      arrow-up
      2
      ·
      23 days ago

      Now B and C cannot be replaced for the purposes of testing the component in isolation, though. The hardcoded dependency just increased the testing complexity by a factor of B * C.

      • Kache@lemm.ee
        link
        fedilink
        arrow-up
        1
        arrow-down
        2
        ·
        edit-2
        23 days ago

        That’s changing the goal posts to “not static”