47
you are viewing a single comment's thread
view the rest of the comments
[-] Kache@lemm.ee 1 points 2 days ago* (last edited 2 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 1 points 2 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 1 points 2 days ago* (last edited 2 days ago)

That's changing the goal posts to "not static"

this post was submitted on 10 Oct 2024
47 points (85.1% liked)

Programming

17185 readers
396 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS