Skip to content

alipayan/SOLIDPrinciples

Repository files navigation

SOLID Principles Repository

Solid principles

Welcome to the SOLID Principles repository 🤟 This repository is dedicated to providing examples, explanations, and resources related to the SOLID principles of object-oriented design. Whether you are a beginner looking to learn about these principles or an experienced developer seeking to refine your skills, this repository has something for you.

Table of contents

Introduction

The SOLID principles are a set of five design principles intended to make software designs more understandable, flexible, and maintainable. The principles were introduced by Robert C. Martin, also known as Uncle Bob, and have since become a fundamental part of object-oriented design.

Principles Overview

Goal of this principle is that a class should only have one repsonsibility, only single reason to change. You may think why this principle is improtant? By apply this principle in our code, we can improve the ability of team working and reduce conflices.

A class or method, should be open for extension and close to modification. That mean, we can always come back and add new functionality, but never change the previous code base.Why this rule is important? When we modify a code base which is stable and test by end users, we take the risk of making new bugs!By help of interfaces and abstract class we can achive to this goal.

Sub classes should be sustitutable for their base classes without facing to abnormal behavior of thier base classes.

In simple word, keep the interfaces seprated.Our classes should not force to implement interface contracts which is irrelevent to them.

Main reason which DIP introduce is to reduce classes from it's dependencies. Instead, we depend on contracts and abstraction.By applying DIP in our code, our class will focus on his own responsibility.


Note

Remember that, to deeply understad this principles, you should keep reading about them and try to implement them in your code bases.


Real-World Examples

Now, you can go and see the code which I write down at this repo.Every dll is assign to signle principle. There are two class, one of them violate principle and in another one, I write down the code base on the principle.

Resources

Here are some recomended resources to learn more about solid principles:

SOLID: The First 5 Principles of Object Oriented Design

The SOLID Principles of Object-Oriented Programming Explained in Plain English

SOLID Principles in Programming: Understand With Real Life Examples

Contributing

I wellcom contributions from the community! If you have another examples or resources to share, please submit a pull request. For major changes, please open an issue first to discuss what you would like to change.

How to contribute

  1. Fork the repository.
  2. Create new branch(git checkout -b example/newExample)
  3. Make your changes.
  4. Commit your changes.(git commit -m "example: your example"
  5. Push the branch.(git push origin example/newExample)
  6. Open a pull request.

License

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

About

Let's review solid principles in code together.

Topics

Resources

License

Stars

Watchers

Forks

Languages