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.

It's right time to invest in Cryptocurrencies Dogecoin! Earn free bitcoins up to $250 now by signing up.

Earn bitcoins upto $250 (free), invest in other Cryptocurrencies when you signup with blockfi. Use the referral link: Signup now and earn!

Using BlockFi, don't just buy crypto - start earning on it. Open an interest account with up to 8.6% APY, trade currencies, or borrow money without selling your assets.

Join CoinBase! We'll both receive $10 in free Bitcoin when they buy or sell their first $100 on Coinbase! Available in India also. Use the referral Join coinbase!

Invest now!!! Get Free equity stock (US, UK only)!

Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.

The Robinhood app makes it easy to trade stocks, crypto and more.

Webull! Receive free stock by signing up using the link: Webull signup.

More Related questions...

Show more question and Answers...


Comments & Discussions