
Single responsibility principle
Every class should have only one reason to change.
Every class should have:
- Only one goal of existence.
- Only one responsibility.
- Only one task to do.
- Only one reason for the modification.
This rule can be applied to methods, functions, classes, modules and packages.
Advantages
- More readable code.
- More understandable code.
- Lack of god-classes — classes, which do everything (or too much) and change with every change in the application.
- Easier software modification and maintenance.
- A small software change only affects one class.
- The modification only affects the area you want to change. A changer does not touch other areas.
- Less error-prone.
Disadvantages
- Many classes.
Examples
- E-mail address validator in a separate class (not with user data).
- Phone number validator in a separate class (not with user data).
- Database writer in a separate class (not with saving data).
- Class with address a separate class (not with client data).
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
- https://pl.wikipedia.org/wiki/Zasada_jednej_odpowiedzialno%C5%9Bci
- https://en.wikipedia.org/wiki/Single_responsibility_principle
- SRP: The Single Responsibility Principle – Robert C. Martin – https://drive.google.com/file/d/0ByOwmqah_nuGNHEtcU5OekdDMkk/view
1
/
30


Tooltip | Bubble.io Quick Tip

Dodawanie i Pobieranie Plików - Upload and Download File | Bubble.io TUTORIAL

2 Kolumnowe Okienko Logowania - 2 Column Login Popup| Bubble.io Quick Tip

KB_ZW_0151 - Refleksje Na Temat Zarządzania Wiedzą: Przepływ

Dynamiczny formularz - Dynamic Form| Bubble.io Quick Tip

Przeglądanie PDFów - PDF File System| Bubble.io Quick Tip

Generowanie PDFa - Create PDFs| Bubble.io TUTORIAL

Zaproszenia do Zespołu - Team Invitations| Bubble.io TUTORIAL

Role Użytkowników - Visibility by User Roles| Bubble.io TUTORIAL

Generowanie SHA256 - Hash Text in SHA256| Bubble.io Quick Tip

KB_ZW_0150 - Refleksje Na Temat Zarządzania Wiedzą: Działanie

Przyciski udostępniania| Bubble.io TUTORIAL

Powiadomienia - Notifications| Bubble.io TUTORIAL

Strona profilowa - Profile Page| Bubble.io TUTORIAL

Wgrywanie Wielu Zdjęć - Picture Uploadin| Bubble.io TUTORIAL

Unikalność Loginów - Check If A Username Is Taken| Bubble.io Quick Tip

Dwa Dropdowny Wykluczające Się z Wartościami Domyślnymi| Bubble.io TUTORIAL

Dwa Dropdowny Wykluczające Się| Bubble.io TUTORIAL

Pełna lista w Repeating Group - Repeating Group Full List| Bubble.io Quick Tip

Przezroczyste tło nagłówka - Transition Header Background| Bubble.io TUTORIAL

KB_ZW_0149 - Refleksje Na Temat Zarządzania Wiedzą: Najważniejsze

Kopiowanie tekstu do schowka - Copy Text to Clipboard| Bubble.io Quick Tip

Kopiowanie elementów do inne aplikacji - Copy elements| Bubble.io Quick Tip

Automatyczne Wylogowywanie - Automatically Log an Inactive User Out| Bubble.io Quick Tip

Przetwarzanie danych w Popupie - Processing Data in Popups| Bubble.io TUTORIAL

Gra Wordle - Build Wordle| Bubble.io TUTORIAL BUDOWA APLIKACJI

Naucz się Tworzyć Aplikacje - Learn to Build Apps| Bubble.io TUTORIAL

Filtrowanie mnniejszych i większych niż - Filtering by Greater & Less Than| Bubble.io Quick Tip

KB_ZW_0148 - Refleksje Na Temat Zarządzania Wiedzą: Poranki

Szukanie w obszarze i podawanie odległości - Finding In Radius And Distance| Bubble.io Quick Tip
1
/
30
