Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

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.

  • No labels