Help the world stop coronavirus! Stay home!

Prev Next

Java / OOPS Concepts and its implementation in Java

SOLID principles of OOD (Object Oriented Design).

SOLID principles provide the specification for the design of a class to ensure high quality.

There are five principles as each letter in SOLID represents one.

The Single Responsibility Principle.

Every class should only serve a single purpose and that responsibility be encapsulated at the same class. For e.g. creating a CAR Class should define the properties that a car would have and along with its functions. It does not have to have Driver Class who drives it.

The Open Closed Principle.

The Open-Closed Principle (OCP) states that classes should be open for extension but be closed for modification.

The Liskov Substitution Principle.

An extension of the Open Close Principle and ensures that new derived classes(child) are extending the base class(parent) without altering its behavior.

The Interface Segregation Principle.

The Interface implementing class should not be forced to implement methods that it don't use. If it forces then it is not compliant to Interface segregation Principle and this interface referred as fat interface. The Fat interface could be fragmented further to be in align with Interface Segregation principle.

The Dependency Inversion Principle.

The principle states:

A. High-level modules should not depend on low-level modules. Both should depend on abstractions.

B. Abstractions should not depend on details. Details should depend on abstractions.

❤Cash Back At Stores you Love !!!❤

Earn your $10 reward when you make your first purchase through Ebates by signing up with clicking below button.

Ebates Coupons and Cash Back

More Related questions...

Show more question and Answers...

Inheritance

Comments & Discussions