๐Ÿญ๐Ÿฎ ๐—ฃ๐—ผ๐—ฝ๐˜‚๐—น๐—ฎ๐—ฟ ๐——๐—ฒ๐˜€๐—ถ๐—ด๐—ป ๐—ฃ๐—ฎ๐˜๐˜๐—ฒ๐—ฟ๐—ป๐˜€ ๐—ถ๐—ป ๐—ฆ๐—ผ๐—ณ๐˜๐˜„๐—ฎ๐—ฟ๐—ฒ ๐—˜๐—ป๐—ด๐—ถ๐—ป๐—ฒ๐—ฒ๐—ฟ๐—ถ๐—ป๐—ด

  1. Factory: Creates objects without specifying th exact class. This pattern makes code flexible and easier to extend, like a factory producing different products.
  2. Observer: Enables objects (observers) to watch changes in another object (subject). When the subject changes, observers are notified automatically, like subscribing to updates.
  3. Singleton: Ensures a class has only one instance accessible globally, useful for shared resources like databases. Think of it as “the one and only.”
  4. Builder: Constructs complex objects step-by-step. Similar to assembling LEGO bricks, this pattern makes it easy to build intricate objects.
  5. Adapter: Converts one interface into another expected by clients, making incompatible components work together. It bridges the gap between different interfaces.
  6. Decorator: Dynamically adds responsibilities to objects without changing their code. Itโ€™s like adding toppings to a pizza, offering a flexible alternative to subclassing.
  7. Proxy: Acts as a virtual representative, controlling access to an object and adding functionality, like lazy loading.
  8. Strategy: Allows selecting algorithms at runtime, enabling flexible switching of strategies to complete a task. Ideal for situations with multiple ways to achieve a goal.
  9. Command: Encapsulates requests as objects, allowing parameterization and queuing, like a to-do list for programs.
  10. Template: Defines the structure of an algorithm with overridable steps, useful for reusable workflows.
  11. Iterator: Provides a way to access elements of a collection sequentially without exposing its underlying structure, like a “tour guide” for collections.
  12. State: Allows an object to change behavior based on its internal state, keeping code organized as different states accumulate. Think of it as a traffic light guiding behavior.