My Works & learnings

SOLID Principles

December 28, 2019

Today I was going through the solid principles training. I had understood key concepts of UML notation and SOLID principles.

UML Diagrams


This is “IS A ” relationship. For example Swift is a Bird. This is indicated by a lollypop symbol.


This is a bidirectional relationship. This is indicated by a straight line.


This is HAS A relation . If you take A and B classes. A class can exist without other class, but B will be having A.


This is a tight coupled HAS A relationship.


Single Responsibity of a class means the class has a single reason to change. Observer pattern with MVC single responsibility principle.

Interface segregation principle

Once lot of clients depend on the component, the changes for a client in the component would start effecting other clients. This is the violation of SRP. To counter this , this principle says to have multiple interfaces implemented, and the component subdivided to smaller components.

Liskov substitution principle

Runtime substituion of any interface should behave simlarly.

Inheritance vs Composition

Inheritance is the tightest coupling. Use it one or two levels. Use composition instead.

Vishnu Sandhireddy

Written by Vishnu Sandhireddy who lives and works in Hyderabad, India. twitter