Skip to content

Examples of design patterns and guide how to implement them ;)

Notifications You must be signed in to change notification settings

AliDeWeb/Design-Patterns-Ts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🐦‍🔥 Design Pattens In Ts - Principle and Rules

By Ali Moradi AliDeWeb

Principles of Object-Oriented Programming (OOP):

  1. Encapsulation – Bundling data and methods within a class while restricting direct access to some details.
  2. Abstraction – Hiding complex implementation details and exposing only the necessary functionality.
  3. Inheritance – Allowing a class to inherit properties and behaviors from another class to promote code reuse.
  4. Polymorphism – Enabling multiple classes to be treated as instances of a common superclass, allowing method overriding and dynamic behavior.

SOLID Principles:

  1. Single Responsibility Principle (SRP) – A class should have only one reason to change, meaning it should have only one responsibility.
  2. Open/Closed Principle (OCP) – Software entities should be open for extension but closed for modification.
  3. Liskov Substitution Principle (LSP) – Subtypes must be substitutable for their base types without altering the correctness of the program.
  4. Interface Segregation Principle (ISP) – Clients should not be forced to depend on interfaces they do not use.
  5. Dependency Inversion Principle (DIP) – High-level modules should not depend on low-level modules; both should depend on abstractions.

Other Important Principles:

Apart from SOLID, other key design principles in OOP include:

  • DRY (Don’t Repeat Yourself) – Avoid duplication by abstracting reusable code.
  • KISS (Keep It Simple, Stupid) – Keep code simple and avoid unnecessary complexity.
  • YAGNI (You Ain’t Gonna Need It) – Don’t implement features unless absolutely necessary.
  • Law of Demeter (LoD) – Objects should only interact with closely related objects to reduce coupling.

These principles ensure maintainability, scalability, and clean code.

📂 Patterns

Design Pattern Documentation
Memento 📜 README
State 📜 README
Iterator 📜 README
Strategy 📜 README
Template Method 📜 README
Command 📜 README

Releases

No releases published

Packages

No packages published