Posts

Showing posts with the label OOPS

SOLID Principles

S.O.L.I.D stands for: S - Single Responsibility Principle O - Open/Closed Principle L - Liskov Substitution Principle I - Interface Segregation Principle D - Dependency Inversion Single responsibility principle A class should have only a single responsibility (i.e. changes to only one part of the software's specification should be able to affect the specification of the class). For example purpose of Object, HashMap, Integer classes is very clear. HashMap should not be responsible to handle TreeMap's job and Integer class should not deal with Float class's job. Open/closed principle Should be open for extension, but closed for modification. This simply means that a class should be easily extendable without modifying the class itself.   Liskov substitution principle Objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program. Mean  interface should hold instance of all sub classes. Java u...