/realworld-design-patterns

Explore real-world scenarios and best practices for design patterns with their unit tests ✅

Primary LanguageTypeScript

design-pattern-cover

Automated Tests Passing Nx License

Real World Design Patterns 🗺️

Explore real-world scenarios and best practices for design patterns in this comprehensive repository. Elevate your software design skills with practical examples and insightful discussions. ✨ This workspace has been generated by Nx, Smart Monorepos · Fast CI.

How to Learn? 📖

For each design pattern, there is folder based on TypeScript. If you are comming from another programming language world, don't worry. They are not complicated.

You can open directory, for instance:

$ cd strategy-pattern

There is a README file that you can review first.

Structure of Readme

Here is some steps in each README file:

  • 💡 Use Case: a short description about the specific problem that we want to solve.
  • ❌ Bad Practice: a typical solution that works but not in a proper way.
  • ✅ Good Practice: implementing the specified design pattern to solve the problem in a proper way.

Diagram: There is also a diagram to represent the oveview of the design pattern to understand better. This is an example:

design-pattern-cover

How to Run

In the root directory, run:

$ npm install

To run the design pattern:

$ npm run -w PATTERN_NAME start

For instance PATTERN_NAME can be strategy-pattern

To run the bad practice:

$ npm run -w PATTERN_NAME start:bad

Run Tests

In order to run tests, run the following command. (add :watch to run it in watch mode):

$ npm run test:watch

Contributing

Contributing to a community project is always welcome.

Checklist

  • Strategy Pattern
  • Dependency Injection Pattern
  • Chain of Responsibility Pattern
  • Builder Pattern
  • Template Method Pattern
  • Command Pattern
  • Decorator Pattern
  • Single Responsibility

Support

Any support is welcome. You can give the project a star, if you liked it ⭐

License

MIT