Design Patterns and Use Cases
Dependency Injection
Class dependencies should be injected instead of being directly constructed. Indeed the whole lifecycle (construction / initialization / destruction) of those dependencies should be deferred to the containing environment in which the code is running. Constructor-injection is to be preferred over setter-injection.
Static state
Staticaly-accessed entities should be avoided whenever possible. They complicate the design, testing and ability of others to customize the product. Communication between components of the system through public statics should be replaced with injected common dependencies, real APIs or an Event Bus as appropriate. Even seemingly innocuous Singletons should be changed to injected dependencies.