Functional Composition with Dependency Injection (IN/Clojure 2016)
Premise for first-class initialization stage in apps and a notion of dependency-passing approach via dependency injection for app initialization while adhering to the time tested Higher-order Functions philosophy.
underlying layer’s implementation detail (cache, connection pool)? • What exactly is the “contract” between the caller and the underlying layer? Is the contract explicit? • How do you test the service layer for failures? Can failures be simulated? Can tests be run in parallel? • How easy is it to instrument or wrap an underlying layer implementation? (resilience, asynchrony etc.)
nil) (def de-init nil) • Update #’injected with all injected objects • Update #’de-init with fn to de-initialize the injected • ((get injected :expose-key) runtime-args…) • Reload support via clojure/tools.namespace
Emacs M-. may not work (true for any HoF) • Exposed names should be namespaced for clarity • Automated cascading injection may be hard to grasp • CLJS support (though CLJS has reiﬁed vars/ns now) • Lack of tooling for navigating exposed names