Skip to content
loading...

Discover and extract dependencies

Home Officer on March 20, 2018

While refactoring some badly tested code, a pattern of how I extract dependencies emerged. The actual intention was to improve the testability. I... [Read Full]
markdown guide
 

Wouldn't this function need to be called everytime with dependencies?

I'm curius as to not why:

const loadStudent = (dependencies = defaultDependencies()) => ({ studentId }) => {
  // ...
};

So the function can now hold state for the initial dependencies given.

 
 

Dependency injection is definitely one of my favorite patterns :-)

Good read!

code of conduct - report abuse