Skip to content

francososa97/DesignPatterns2.0

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Design Patterns Guide

This guide provides a comprehensive overview and demonstration of various design patterns. Each section of the project corresponds to a specific design pattern, with explanations and practical examples.

List of Design Patterns

  1. Abstract Factory
  2. Adapter
  3. Bridge
  4. Builder
  5. Composite
  6. Decorator
  7. Facade
  8. Factory Method
  9. Flyweight
  10. Model-View-Controller (MVC)
  11. Prototype
  12. Singleton
  13. Observer
  14. State
  15. Strategy
  16. Template Method
  17. Visitor
  18. Chain of Responsibility
  19. Command
  20. Interpreter
  21. Iterator
  22. Mediator
  23. Memento
  24. Proxy
  25. MVVM
  26. Repository
  27. Unit of Work
  28. Dependency Injection
  29. Service Locator
  30. Event Sourcing
  31. CQRS
  32. Lazy Initialization
  33. Active Object
  34. Scheduler
  35. Producer-Consumer
  36. Thread Pool
  37. Monitor Object
  38. Microservices
  39. Service-Oriented Architecture (SOA)
  40. Event-Driven Architecture
  41. Layered Architecture

Design Pattern Explained

  • Abstract Factory: Provides an interface for creating families of related or dependent objects without specifying their concrete classes. This pattern is useful when a system must be independent of how its objects are created.

  • Adapter: Allows incompatible interfaces to work together by converting the interface of a class into another interface expected by the client. It is useful for integrating components that were not designed to work together.

  • Bridge: Separates an abstraction from its implementation, allowing both to evolve independently. This pattern is useful to avoid an exponential growth in the number of classes needed to represent combinations of abstractions and implementations.

  • Builder : Allows constructing complex objects step by step, separating the construction from the final representation. This pattern is useful when an object can be constructed in many different ways.

  • Composite: Lets you treat individual objects and compositions of objects uniformly. This pattern is useful for representing hierarchies of objects and treating both simple and composite objects consistently.

  • Decorator: Allows adding additional behavior to objects dynamically by wrapping them in objects of the same class. This pattern is useful when you want to extend the functionality of objects in a flexible way.

  • Facade: Provides a simplified interface to a complex subsystem of interfaces. This pattern is useful to make a system easier to use and understand.

  • Factory Method: Defines a method for creating objects in a superclass, but allows subclasses to alter the type of objects that are created. This pattern is useful to delegate the responsibility of object creation to subclasses.

  • Flyweight: Minimizes memory usage by sharing as much data as possible with similar objects. This pattern is useful when a large number of similar objects occupy a significant amount of memory.

  • Model-View-Controller (MVC): Separates the application into three main components: Model, View, and Controller. This pattern is useful for structuring applications so that business logic is separated from the user interface.

  • Prototype: Allows creating new objects by copying an existing object instead of creating instances from scratch. This pattern is useful when object creation is costly or complex.

  • Singleton: Ensures a class has only one instance and provides a global point of access to this instance. This pattern is useful for managing shared resources or global configurations.

  • Observer: Defines a one-to-many dependency between objects, so that when one object changes state, all its dependents are notified and updated automatically. This pattern is useful for implementing events or notification systems.

  • State: Allows an object to alter its behavior when its internal state changes. This pattern is useful for objects that need to change their behavior dynamically based on their state.

  • Strategy: Defines a family of algorithms, encapsulates each one, and makes them interchangeable. This pattern is useful for changing the behavior of an algorithm at runtime.

  • Template Method: Defines the skeleton of an algorithm in a superclass, allowing subclasses to implement specific steps of the algorithm. This pattern is useful when several classes share the structure of an algorithm but differ in specific steps.

  • Visitor: Allows defining a new operation without changing the classes of the elements on which it operates. This pattern is useful when you need to perform operations on a structure of objects without modifying their classes.

  • Chain of Responsibility: Lets several objects have the opportunity to handle a request by passing it along a chain of handlers until one of them processes it. This pattern is useful for decoupling the sender of a request from its receivers.

  • Command: Turns a request into a stand-alone object that contains all information about the request. This pattern is useful for parameterizing methods with different requests, delaying or queuing the execution of a request, and supporting undoable operations.

  • Interpreter: Defines a grammar for a language and provides an interpreter to interpret sentences in that language. This pattern is useful for evaluating dynamic expressions in a specific language.

  • Iterator: Provides a way to access the elements of a collection sequentially without exposing its underlying representation. This pattern is useful for traversing collections without exposing their internal structure.

  • Mediator: Defines an object that encapsulates how a set of objects interact. This pattern is useful for reducing dependencies between objects by making them communicate only through the mediator.

  • Memento: Allows capturing and restoring the internal state of an object without violating its encapsulation. This pattern is useful for implementing undo and redo functionality.

  • Proxy: Provides a surrogate or placeholder for another object, controlling access to it. This pattern is useful for implementing access control, caching, or optimizing performance for expensive operations.

  • Repository: Abstracts the data access logic, providing a cleaner and clearer interface for performing CRUD operations. This pattern is useful for decoupling business logic from persistence logic.

  • Unit of Work: Coordinates the operations of multiple repositories, ensuring that all modifications to data are made within a single transaction. This pattern is useful for handling transactions efficiently.

  • Dependency Injection: Allows injecting external dependencies into a class instead of having the class create these dependencies. This pattern is useful for improving modularity and testability of the code.

  • Service Locator: Centralizes access to services, allowing registering and obtaining dependencies flexibly. This pattern simplifies the management and maintenance of services but can obscure dependencies, making testing and maintenance harder.

  • Event Sourcing: Stores the state of a system as a sequence of events. This pattern ensures that the state of the system can be reconstructed or reverted at any time.

  • CQRS: Segregates read and write operations into different models, optimizing each for their respective tasks. This pattern is useful in systems where read and write operations have different performance requirements.

  • Lazy Initialization: Delays the creation of an object until it is first needed, improving performance and optimizing resource usage. This pattern is useful when an object may not be needed during the program's execution.

  • Active Object: Separates the invocation of a method from its execution, allowing methods to execute asynchronously. This pattern improves concurrency and responsiveness but adds complexity in thread management.

  • Scheduler: Manages task execution by distributing them efficiently among available resources. Controls the order and priority of execution, improving resource utilization but can be complex to implement.

  • Producer-Consumer: Decouples the production and consumption of data or tasks, allowing producers and consumers to operate at different paces. This pattern is useful in concurrent systems where production and consumption are not directly synchronized.

  • Thread Pool: Reuses a pool of threads to handle multiple concurrent tasks, improving efficiency and performance. This pattern limits the overhead of thread creation and destruction but may introduce latency under high load.

  • Monitor Object: Ensures mutual exclusion in the execution of methods, guaranteeing that only one thread can access at a time. This pattern is crucial for synchronization in concurrent applications but may lead to deadlocks if not managed properly.

  • Microservices: Divides an application into a set of small, autonomous, and highly cohesive services that can be deployed and scaled independently. This pattern is useful for building large and complex systems with high availability and scalability.

  • Service-Oriented Architecture (SOA): Organizes applications into autonomous services that interact through well-defined interfaces. Promotes modularity, reuse, and scalability but introduces complexity in managing service communication.

  • Event-Driven Architecture: Organizes communication between components through events, allowing components to react to state changes in a decoupled manner. This pattern is useful for systems that require high scalability and flexibility.

  • Layered Architecture: Organizes the system into hierarchical layers where each layer has a specific responsibility. Promotes separation of concerns and facilitates maintainability but can introduce overhead if layers are not well defined.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages