Spis treści
SOLID
SOLID principles are basic rules of object-oriented programming. You should not only know them but also practice and use them at work. At first, I remind you of SOLID principles, and then I show you some exercises.
Single responsibility principle
Every class should have only one responsibility (every class should have only one reason to change) — one purpose of existence.
Open/closed principle
All classes should be open for enlargement and closed for modifications.
Liskov substitution principle
The application should work correctly when we put in the base class place every derived class.
Interface segregation principle
Many small and dedicated interfaces are better than few and general.
Dependency inversion principle
High-level modules should not depend on low-level modules, but the dependence should result from abstraction.
SOLID principles exercises
- Write code and think about principles.
- Sometimes read SOLID principles.
- Read code other programmers and look for principles there.
- Observe, how your code is changing. If SOLID principles help to handle changes, or they cause bigger problems.
- Read code with examples of principles.
- Give your code to review and ask reviewer about principles
Check sites with SOLID exercises:
- https://www.codeguru.com/csharp/csharp/writing-c-code-using-solid-principles.htm
- https://dotnetcodr.com/2016/12/22/rewriting-hello-world-according-to-solid-in-net/#more-8973
- https://www.c-sharpcorner.com/UploadFile/damubetha/solid-principles-in-C-Sharp/
- https://blog.thedigitalgroup.com/solid-architecture-principle-using-c-with-simple-c-example
- https://www.codeproject.com/Articles/703634/SOLID-Architecture-Principles-Using-Simple-Csharp
- https://www.dotnetforall.com/solid-design-principles-examples/
- https://stackoverflow.com/questions/16638873/how-to-practice-solid-principle-of-oop-design
- https://journal.artfuldev.com/do-you-write-solid-c-code-expanding-upon-the-single-responsibility-principle-part-1-846dc48f876a
- https://dzone.com/articles/solid-grasp-and-other-basic-principles-of-object-o
- https://github.com/hammer4/SoftUni/tree/master/C%23%20OOP%20Advanced
All posts from mini project: Learn SOLID and OOP principles:
- SOLID
- SOLID exercises
- S like Single responsibility principle
- SOLID exercises — Kata
- O as Open-closed principle
- L jak Liskov Substitution Principle
- Interface segregation principle
- KISS — Keep it simple, stupid
- DRY — Don’t repeat yourself
- Dependency inversion principle
- SLAP — Single Level of Abstraction Principle
- Composition Over Inheritance
- Encapsulate what changes
- Lod — Law of Demeter
- ES as Exercises of Single responsibility principle
- EO as Exercises of Open/closed principle
- EL as Exercises of Liskov Substitution Principle
- EI as Eexrcises of Interface segregation principle
- ES as Exercises of Dependency Inversion Principle
- Object-oriented programming
- OOP — Object-Oriented Programming — Advice
- OOP — Object Oriented Programming
Sources
Main image
Materials
- Book: Clean architecture — Robert C. Martin
- http://butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod
- https://en.wikipedia.org/wiki/SOLID
- https://pl.wikipedia.org/wiki/SOLID_(programowanie_obiektowe)
- https://www.samouczekprogramisty.pl/solid-czyli-dobre-praktyki-w-programowaniu-obiektowym/
- https://www.p-programowanie.pl/paradygmaty-programowania/zasady-solid/
- https://javadeveloper.pl/solid/
- https://sii.pl/blog/solid-dobre-praktyki-programowania/
- https://devcave.pl/notatnik-juniora/zasady-projektowania-kodu
Sorry, there was a YouTube error.
I was suggested this web site by my cousin. I am not
sure whether this post is written by him as no one else
know such detailed about my difficulty. You are incredible!
Thanks!