Talk:Dependency injection/Archives/2017/July
Appearance
This is an archive of past discussions about Dependency injection. Do not edit the contents of this page. If you wish to start a new discussion or revive an old one, please do so on the current talk page. |
UML class and sequence diagram
I would like to share the following UML diagrams I have published on Design Patterns Open Online Learning. Your comments are welcomed!
In the above UML class diagram, the Client
class
that requires ServiceA
and ServiceB
objects doesn't instantiate the ServiceA1
and ServiceB1
classes directly.
Instead, an Injector
class creates the objects and injects them
into the Client
, which makes the Client
independent of how the objects are created (which concrete classes are instantiated).
The UML sequence diagram shows the run-time interactions: The Injector
object creates the ServiceA1
and ServiceB1
objects.
Thereafter, the Injector
creates the Client
object
and injects the ServiceA1
and ServiceB1
objects.