Best Practices
登录后可跨设备保存划线和私人笔记登录
Guice Best Practices
- 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
@Providesmethods over the binding DSL - Avoid calling
@Providesmethods and@Injectconstructors directly - Don't reuse binding annotations (aka
@Qualifiers) - Organize modules by feature, not by class type
- Document the public bindings provided by modules
评论
登录后参与评论
正在加载评论…
KnowForge