News for hackers. Stuff that matters.
Re:Ask HN: Concepts that clicked only years after you first ... by ngc248 on Sunday January 01, 2023 @10:17AM (#34206922)
It is a pattern where you inject the dependencies of a class into it rather than create the instances of the dependencies within the class. for more info --> https://en.wikipedia.org/wiki/Dependency_injection

it makes the code cleaner and testable.

Re:Ask HN: Concepts that clicked only years after you first ... by everybodyknows on Sunday January 01, 2023 @11:21AM (#34207600)
What I find troubling about that page is that it does not qualify up front whether the dependencies are:

A. Also depended upon by other, coequal unrelated classes, possibly maintained by others, OR

B. Depended upon only by a single class (of higher functionality)

Situation A is sometimes called a portability interface; B might be called an internal structuring interface.

The difference has crucial implications for social power relationships between the human developers and users involved.