Jump to content

Talk:Dependency injection/Archives/2017/July

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

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!

A sample UML class and sequence diagram for the Dependency Injection design pattern.

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.

Vanderjoe (talk) 12:31, 9 July 2017 (UTC)