|
|
 | |  |
| By Inverting the ownership we have inverted the dependancy and satisfied the DIP. Let's see the new UML. | |
 | |  |
|
 |
|
|
|
|
|
 | |  |
| Here I changed the interface name to SwitchableInterface to clearly show that Ownership lies with Switch. And change in interface will happen only when policy changes. | |
 | |  |
|
 |
 | |  |
| Yes I got it ! So change will happen when client wants and it will not be forced by implementation classes Like Fan Now. | |
 | |  |
|
|
|