kessler / darkmagic

An experimental opinionated dependency injection module
MIT License
21 stars 0 forks source link

Insights #7

Open kessler opened 9 years ago

kessler commented 9 years ago

A bunch of insights I had so far from experimenting with darkmagic:

  1. Async modules are fun, they make life easy
  2. Being able to selectively replace dependencies makes writing tests easier too
  3. Having one injector per process might be a problem in the long run
  4. "Riding" on the real module system cache has pros and cons (need to expand on that)
  5. Dependency inference needs stronger syntax than just parsing the parameters of a function. Should I give it to something like requirejs' string dependency array?
  6. dependency declaration at the client site needs to be decoupled from dependency declaration at the provider site, more specifically, if site A needs dep named B, this dep might be loaded without actually using the name B, but once loaded it will declare itself as B