dime
dime copied to clipboard
Dependency Injection Made Easy for Clojure
dime
Dependency Injection Made Easy for Clojure. This blog post explains the premise.
Rationale
Initializing and wiring up components in a non-trivial application could be a complex and brittle affair. It could be stateful, repetitive, messy or all of those. Dime aims to make that process less error-prone, repeatable and easy to reason about by implementing mostly-automated dependency injection/inversion.
Goals
- Easy, push-model dependency injection
- Flexible and easy lifecycle management
- Thorough testability, avoiding pitfalls
- Avoid mutation (except in development)
Caveats (Trade off)
- Opinionated in favor of decoupling
- Cascading dependencies (minimize with Onion Architecture or Functional Core, Imperative Shell approach)
- Overhead of tagging all dependencies
- Cannot inject in multimethods out of the box
Other work
The following projects take different approaches to dependency management:
Usage
Clojars coordinates: [dime "0.5.2"]
See Documentation
Discuss
Slack channel: #dime (you need an invitation from http://clojurians.net/ to join the Clojurian Slack team)
Development
Running tests:
$ lein do clean, test # run tests in lowest supported Clojure version
License
Copyright © 2016-2021 Shantanu Kumar
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.