-
Notifications
You must be signed in to change notification settings - Fork 1.7k
BestPractices
Googler edited this page Apr 8, 2021
·
7 revisions
- Minimize mutability
- Inject only direct dependencies
- Use the Injector as little as possible (preferably only once)
- Avoid cyclic dependencies
- Avoid static state
- Use
@Nullable
- Modules should be fast and side-effect free
- Be careful about I/O in Providers
- Avoid conditional logic in modules
- Keep constructors as hidden as possible
- Avoid binding Closable resources
- Prefer
@Provides
methods over the binding DSL - Avoid calling
@Provides
methods and@Inject
constructors directly - Don't reuse binding annotations (aka
@Qualifiers
) - Organize modules by feature, not by class type
- Document the public bindings provided by modules
-
User's Guide
-
Integration
-
Extensions
-
Internals
-
Releases
-
Community