Skip to content

Latest commit

 

History

History
38 lines (20 loc) · 2.36 KB

README.md

File metadata and controls

38 lines (20 loc) · 2.36 KB

Solid-principles

In software engineering, SOLID is a mnemonic acronym for five design principles intended to make object-oriented designs more understandable, flexible, and maintainable. The principles are a subset of many principles promoted by American software engineer and instructor Robert C. Martin.

What are the SOLID principles?

The SOLID principles are:

  • The single-responsibility principle: "There should never be more than one reason for a class to change." In other words, every class should have only one responsibility.

  • The open–closed principle: "Software entities ... should be open for extension, but closed for modification."

  • The Liskov substitution principle: "Functions that use pointers or references to base classes must be able to use objects of derived classes without knowing it." See also design by contract.

  • The interface segregation principle: "Clients should not be forced to depend upon interfaces that they do not use."

  • The dependency inversion principle: "Depend upon abstractions, [not] concretions."

Each principle has its own goal and set of guidelines to follow.

How to use this repository

This repository contains examples of how to implement each of the SOLID principles in Java. Each principle has its own directory containing a README.md file explaining the principle and a Java example demonstrating how to apply the principle. The examples are designed to be simple and easy to understand, but they also cover some common scenarios where the principles can be applied.

Feel free to explore the examples and use them as a reference for your own projects. You can also submit pull requests if you find any issues or have ideas for improvements.

Contributing

If you'd like to contribute to this repository, please open an issue or submit a pull request. All contributions are welcome, whether it's fixing a typo, adding a new example, or suggesting a better way to explain a principle.

License

This repository is licensed under the MIT License. See the LICENSE file for more information.

Acknowledgements

The examples in this repository are based on the SOLID principles and code samples provided by Robert C. Martin in his book "Clean Architecture: A Craftsman's Guide to Software Structure and Design".