Skip to content

This repository contains the real simple examples of how should we use and accept the SOLID principle in our daily coding

Notifications You must be signed in to change notification settings

happysingh23828/SOLID-principles-java-example

Repository files navigation

SOLID-Design-Pattern-Java-Example

This repository contains the real simple examples of how should we use and accept the SOLID principle in our daily coding

What is SOLID principle?

SOLID Principles is a coding standard that all developers should have a clear concept for developing software in a proper way to avoid a bad design. SOLID is a mnemonic acronym for five design principles intended to make software designs more understandable, flexible and maintainable.It was promoted by Robert C Martin and is used across the object-oriented design spectrum

Why we need SOLID principle?

When the developer builds a software following the bad design, the code can become inflexible and more brittle, small changes in the software can result in bugs. For these reasons, we should follow SOLID Principles. It takes some time to understand, but if you write code following the principles it will improve code quality and will help to understand the most well-designed software.

5 principles

1.Single responsibility principle

A class should only have a single responsibility, that is, only changes to one part of the software's specification should be able to affect the specification of the class.

2.Open–closed principle

"Software entities ... should be open for extension, but closed for modification."

3.Liskov substitution principle

"Objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program." See also design by contract.

4.Interface segregation principle

"Many client-specific interfaces are better than one general-purpose interface."

5.Dependency inversion principle

One should "depend upon abstractions,concretions."

What this Repository contains?

So in this repository we have five packages of each principle. Each principle has some scenario to understand it and in each principle's packages we have two package Good and Bad.

Contributing

Please fork this repository and contribute back using pull requests.

Any contributions, large or small, major features, bug fixes, are welcomed and appreciated but will be thoroughly reviewed .

- Contact - Let's become friend

Referenced

About

This repository contains the real simple examples of how should we use and accept the SOLID principle in our daily coding

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages