Markus 5ce932ceb7 Work on #213
- properly categorize all patterns
- remove pattern list from readme
- minor fixes to readme
- removed "introduction" because its not a pattern and an error i
committed some time ago
2015-08-20 21:40:07 +02:00

880 B

layout, title, folder, permalink, categories, tags
layout title folder permalink categories tags
pattern Dependency Injection dependency-injection /patterns/dependency-injection/ Behavioral Java

Intent: Dependency Injection is a software design pattern in which one or more dependencies (or services) are injected, or passed by reference, into a dependent object (or client) and are made part of the client's state. The pattern separates the creation of a client's dependencies from its own behavior, which allows program designs to be loosely coupled and to follow the inversion of control and single responsibility principles.

alt text

Applicability: Use the Dependency Injection pattern when

  • when you need to remove knowledge of concrete implementation from object
  • to enable unit testing of classes in isolation using mock objects or stubs