Ray.Di Best Practices
- Minimize mutability
- Inject only direct dependencies
- Use the Injector as little as possible (preferably only once)
- Avoid cyclic dependencies
- Avoid static state
- Modules should be fast and side-effect free
- Avoid conditional logic in modules
- Don’t reuse binding attributes (aka
#[Qualifiers]
) - Organize modules by feature, not by class type
- Document the public bindings provided by modules