{"id":750,"date":"2024-09-01T08:18:37","date_gmt":"2024-09-01T08:18:37","guid":{"rendered":"https:\/\/slapps.fr\/steve\/?p=750"},"modified":"2024-09-01T08:18:40","modified_gmt":"2024-09-01T08:18:40","slug":"design-patterns-2","status":"publish","type":"post","link":"https:\/\/slapps.fr\/steve\/design-patterns-2\/","title":{"rendered":"Design Patterns"},"content":{"rendered":"\n<p>Here are some of the most common design patterns in software development today:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. <strong>Singleton Pattern<\/strong><\/h3>\n\n\n\n<ul>\n<li><strong>Purpose<\/strong>: Ensures a class has only one instance and provides a global point of access to it.<\/li>\n\n\n\n<li><strong>Use Cases<\/strong>: Used in configurations, logging, database connections, etc.<\/li>\n\n\n\n<li><strong>Why Popular<\/strong>: Helps in managing shared resources efficiently.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">2. <strong>Factory Method Pattern<\/strong><\/h3>\n\n\n\n<ul>\n<li><strong>Purpose<\/strong>: Defines an interface for creating objects but lets subclasses alter the type of objects that will be created.<\/li>\n\n\n\n<li><strong>Use Cases<\/strong>: When a class can&#8217;t anticipate the type of objects it needs to create or when objects need to be created with varying configurations.<\/li>\n\n\n\n<li><strong>Why Popular<\/strong>: Promotes loose coupling and scalability.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">3. <strong>Observer Pattern<\/strong><\/h3>\n\n\n\n<ul>\n<li><strong>Purpose<\/strong>: Allows an object (the subject) to notify other objects (observers) about changes in its state.<\/li>\n\n\n\n<li><strong>Use Cases<\/strong>: Event handling systems, real-time messaging, data binding in user interfaces.<\/li>\n\n\n\n<li><strong>Why Popular<\/strong>: Facilitates the implementation of event-driven systems.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">4. <strong>Decorator Pattern<\/strong><\/h3>\n\n\n\n<ul>\n<li><strong>Purpose<\/strong>: Attaches additional responsibilities to an object dynamically. Provides a flexible alternative to subclassing for extending functionality.<\/li>\n\n\n\n<li><strong>Use Cases<\/strong>: Used for adding features or behaviors at runtime without altering the object structure.<\/li>\n\n\n\n<li><strong>Why Popular<\/strong>: Supports Open\/Closed Principle by allowing enhancements without modifying existing code.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">5. <strong>Strategy Pattern<\/strong><\/h3>\n\n\n\n<ul>\n<li><strong>Purpose<\/strong>: Defines a family of algorithms, encapsulates each one, and makes them interchangeable.<\/li>\n\n\n\n<li><strong>Use Cases<\/strong>: Used when you have multiple ways of doing something, like sorting or validating data.<\/li>\n\n\n\n<li><strong>Why Popular<\/strong>: Enhances flexibility by allowing algorithms to be selected at runtime.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">6. <strong>Command Pattern<\/strong><\/h3>\n\n\n\n<ul>\n<li><strong>Purpose<\/strong>: Encapsulates a request as an object, thereby allowing for parameterization of clients with different requests.<\/li>\n\n\n\n<li><strong>Use Cases<\/strong>: Undo\/redo operations, queuing tasks, and logging changes.<\/li>\n\n\n\n<li><strong>Why Popular<\/strong>: Decouples sender and receiver, making the system more modular and extensible.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">7. <strong>Builder Pattern<\/strong><\/h3>\n\n\n\n<ul>\n<li><strong>Purpose<\/strong>: Separates the construction of a complex object from its representation, allowing the same construction process to create different representations.<\/li>\n\n\n\n<li><strong>Use Cases<\/strong>: When creating objects with many optional parameters.<\/li>\n\n\n\n<li><strong>Why Popular<\/strong>: Simplifies object creation and enhances code readability.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">8. <strong>Adapter Pattern<\/strong><\/h3>\n\n\n\n<ul>\n<li><strong>Purpose<\/strong>: Converts an interface of a class into another interface clients expect. Allows incompatible interfaces to work together.<\/li>\n\n\n\n<li><strong>Use Cases<\/strong>: Integrating with third-party code or legacy systems.<\/li>\n\n\n\n<li><strong>Why Popular<\/strong>: Increases compatibility between different components or libraries.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">9. <strong>Microservices Pattern<\/strong><\/h3>\n\n\n\n<ul>\n<li><strong>Purpose<\/strong>: Structures an application as a collection of loosely coupled services.<\/li>\n\n\n\n<li><strong>Use Cases<\/strong>: Highly scalable, independently deployable services in cloud-native applications.<\/li>\n\n\n\n<li><strong>Why Popular<\/strong>: Enables continuous delivery, scalability, and easier management of complex applications.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">10. <strong>Event Sourcing Pattern<\/strong><\/h3>\n\n\n\n<ul>\n<li><strong>Purpose<\/strong>: Stores the state of a system as a sequence of state-changing events.<\/li>\n\n\n\n<li><strong>Use Cases<\/strong>: Financial systems, logging systems, and applications where maintaining a full history of state changes is crucial.<\/li>\n\n\n\n<li><strong>Why Popular<\/strong>: Provides a complete audit trail and allows easy recovery and replay of states.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">11. <strong>CQRS (Command Query Responsibility Segregation) Pattern<\/strong><\/h3>\n\n\n\n<ul>\n<li><strong>Purpose<\/strong>: Segregates read and write operations to optimize performance, scalability, and security.<\/li>\n\n\n\n<li><strong>Use Cases<\/strong>: Systems with heavy read or write operations where the data model differs for reads and writes.<\/li>\n\n\n\n<li><strong>Why Popular<\/strong>: Improves scalability, performance, and simplifies complex data flows.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">12. <strong>API Gateway Pattern<\/strong><\/h3>\n\n\n\n<ul>\n<li><strong>Purpose<\/strong>: Provides a single entry point for a group of microservices, handling cross-cutting concerns like security, monitoring, and rate limiting.<\/li>\n\n\n\n<li><strong>Use Cases<\/strong>: Microservices architecture, serverless computing.<\/li>\n\n\n\n<li><strong>Why Popular<\/strong>: Simplifies client interaction with microservices and centralizes concerns.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">13. <strong>Mediator Pattern<\/strong><\/h3>\n\n\n\n<ul>\n<li><strong>Purpose<\/strong>: Defines an object that encapsulates how a set of objects interact. Promotes loose coupling by keeping objects from referring to each other explicitly.<\/li>\n\n\n\n<li><strong>Use Cases<\/strong>: Chat systems, complex workflows, UI components that need to communicate.<\/li>\n\n\n\n<li><strong>Why Popular<\/strong>: Reduces dependencies between communicating objects.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">14. <strong>Chain of Responsibility Pattern<\/strong><\/h3>\n\n\n\n<ul>\n<li><strong>Purpose<\/strong>: Passes a request along a chain of handlers, allowing each handler to either handle the request or pass it to the next handler.<\/li>\n\n\n\n<li><strong>Use Cases<\/strong>: Event processing pipelines, middleware stacks, authorization checks.<\/li>\n\n\n\n<li><strong>Why Popular<\/strong>: Enhances flexibility in assigning responsibilities and handling requests dynamically.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">15. <strong>Proxy Pattern<\/strong><\/h3>\n\n\n\n<ul>\n<li><strong>Purpose<\/strong>: Provides a surrogate or placeholder for another object to control access to it.<\/li>\n\n\n\n<li><strong>Use Cases<\/strong>: Caching, lazy initialization, and access control.<\/li>\n\n\n\n<li><strong>Why Popular<\/strong>: Enhances performance, security, and control over resource access.<\/li>\n<\/ul>\n\n\n\n<p>These patterns address various design concerns such as scalability, flexibility, maintainability, and reusability, making them integral to modern software development practices.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here are some of the most common design patterns in software development today: 1. Singleton Pattern 2. Factory Method Pattern 3. Observer Pattern 4. Decorator Pattern 5. Strategy Pattern 6. Command Pattern 7. Builder Pattern 8. Adapter Pattern 9. Microservices Pattern 10. Event Sourcing Pattern 11. CQRS (Command Query Responsibility Segregation) Pattern 12. API Gateway &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/slapps.fr\/steve\/design-patterns-2\/\"> <span class=\"screen-reader-text\">Design Patterns<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"default","ast-global-header-display":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","footnotes":"","_jetpack_memberships_contains_paid_content":false},"categories":[1],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Design Patterns - \/steve<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/slapps.fr\/steve\/design-patterns-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Design Patterns - \/steve\" \/>\n<meta property=\"og:description\" content=\"Here are some of the most common design patterns in software development today: 1. Singleton Pattern 2. Factory Method Pattern 3. Observer Pattern 4. Decorator Pattern 5. Strategy Pattern 6. Command Pattern 7. Builder Pattern 8. Adapter Pattern 9. Microservices Pattern 10. Event Sourcing Pattern 11. CQRS (Command Query Responsibility Segregation) Pattern 12. API Gateway &hellip; Design Patterns Read More &raquo;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/slapps.fr\/steve\/design-patterns-2\/\" \/>\n<meta property=\"og:site_name\" content=\"\/steve\" \/>\n<meta property=\"article:published_time\" content=\"2024-09-01T08:18:37+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-09-01T08:18:40+00:00\" \/>\n<meta name=\"author\" content=\"steve\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"steve\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/slapps.fr\/steve\/design-patterns-2\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/slapps.fr\/steve\/design-patterns-2\/\"},\"author\":{\"name\":\"steve\",\"@id\":\"https:\/\/slapps.fr\/steve\/#\/schema\/person\/84acbf31a96288aab67de8d34c50b595\"},\"headline\":\"Design Patterns\",\"datePublished\":\"2024-09-01T08:18:37+00:00\",\"dateModified\":\"2024-09-01T08:18:40+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/slapps.fr\/steve\/design-patterns-2\/\"},\"wordCount\":670,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/slapps.fr\/steve\/#\/schema\/person\/84acbf31a96288aab67de8d34c50b595\"},\"inLanguage\":\"en-AU\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/slapps.fr\/steve\/design-patterns-2\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/slapps.fr\/steve\/design-patterns-2\/\",\"url\":\"https:\/\/slapps.fr\/steve\/design-patterns-2\/\",\"name\":\"Design Patterns - \/steve\",\"isPartOf\":{\"@id\":\"https:\/\/slapps.fr\/steve\/#website\"},\"datePublished\":\"2024-09-01T08:18:37+00:00\",\"dateModified\":\"2024-09-01T08:18:40+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/slapps.fr\/steve\/design-patterns-2\/#breadcrumb\"},\"inLanguage\":\"en-AU\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/slapps.fr\/steve\/design-patterns-2\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/slapps.fr\/steve\/design-patterns-2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/slapps.fr\/steve\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Design Patterns\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/slapps.fr\/steve\/#website\",\"url\":\"https:\/\/slapps.fr\/steve\/\",\"name\":\"Steve\",\"description\":\"Automated Assets\",\"publisher\":{\"@id\":\"https:\/\/slapps.fr\/steve\/#\/schema\/person\/84acbf31a96288aab67de8d34c50b595\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/slapps.fr\/steve\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-AU\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/slapps.fr\/steve\/#\/schema\/person\/84acbf31a96288aab67de8d34c50b595\",\"name\":\"steve\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-AU\",\"@id\":\"https:\/\/slapps.fr\/steve\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/slapps.fr\/steve\/wp-content\/uploads\/2025\/01\/cropped-slapps-black-banner.png\",\"contentUrl\":\"https:\/\/slapps.fr\/steve\/wp-content\/uploads\/2025\/01\/cropped-slapps-black-banner.png\",\"width\":300,\"height\":100,\"caption\":\"steve\"},\"logo\":{\"@id\":\"https:\/\/slapps.fr\/steve\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/slapps.fr\/steve\"],\"url\":\"https:\/\/slapps.fr\/steve\/author\/steve\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Design Patterns - \/steve","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/slapps.fr\/steve\/design-patterns-2\/","og_locale":"en_US","og_type":"article","og_title":"Design Patterns - \/steve","og_description":"Here are some of the most common design patterns in software development today: 1. Singleton Pattern 2. Factory Method Pattern 3. Observer Pattern 4. Decorator Pattern 5. Strategy Pattern 6. Command Pattern 7. Builder Pattern 8. Adapter Pattern 9. Microservices Pattern 10. Event Sourcing Pattern 11. CQRS (Command Query Responsibility Segregation) Pattern 12. API Gateway &hellip; Design Patterns Read More &raquo;","og_url":"https:\/\/slapps.fr\/steve\/design-patterns-2\/","og_site_name":"\/steve","article_published_time":"2024-09-01T08:18:37+00:00","article_modified_time":"2024-09-01T08:18:40+00:00","author":"steve","twitter_card":"summary_large_image","twitter_misc":{"Written by":"steve","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/slapps.fr\/steve\/design-patterns-2\/#article","isPartOf":{"@id":"https:\/\/slapps.fr\/steve\/design-patterns-2\/"},"author":{"name":"steve","@id":"https:\/\/slapps.fr\/steve\/#\/schema\/person\/84acbf31a96288aab67de8d34c50b595"},"headline":"Design Patterns","datePublished":"2024-09-01T08:18:37+00:00","dateModified":"2024-09-01T08:18:40+00:00","mainEntityOfPage":{"@id":"https:\/\/slapps.fr\/steve\/design-patterns-2\/"},"wordCount":670,"commentCount":0,"publisher":{"@id":"https:\/\/slapps.fr\/steve\/#\/schema\/person\/84acbf31a96288aab67de8d34c50b595"},"inLanguage":"en-AU","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/slapps.fr\/steve\/design-patterns-2\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/slapps.fr\/steve\/design-patterns-2\/","url":"https:\/\/slapps.fr\/steve\/design-patterns-2\/","name":"Design Patterns - \/steve","isPartOf":{"@id":"https:\/\/slapps.fr\/steve\/#website"},"datePublished":"2024-09-01T08:18:37+00:00","dateModified":"2024-09-01T08:18:40+00:00","breadcrumb":{"@id":"https:\/\/slapps.fr\/steve\/design-patterns-2\/#breadcrumb"},"inLanguage":"en-AU","potentialAction":[{"@type":"ReadAction","target":["https:\/\/slapps.fr\/steve\/design-patterns-2\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/slapps.fr\/steve\/design-patterns-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/slapps.fr\/steve\/"},{"@type":"ListItem","position":2,"name":"Design Patterns"}]},{"@type":"WebSite","@id":"https:\/\/slapps.fr\/steve\/#website","url":"https:\/\/slapps.fr\/steve\/","name":"Steve","description":"Automated Assets","publisher":{"@id":"https:\/\/slapps.fr\/steve\/#\/schema\/person\/84acbf31a96288aab67de8d34c50b595"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/slapps.fr\/steve\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-AU"},{"@type":["Person","Organization"],"@id":"https:\/\/slapps.fr\/steve\/#\/schema\/person\/84acbf31a96288aab67de8d34c50b595","name":"steve","image":{"@type":"ImageObject","inLanguage":"en-AU","@id":"https:\/\/slapps.fr\/steve\/#\/schema\/person\/image\/","url":"https:\/\/slapps.fr\/steve\/wp-content\/uploads\/2025\/01\/cropped-slapps-black-banner.png","contentUrl":"https:\/\/slapps.fr\/steve\/wp-content\/uploads\/2025\/01\/cropped-slapps-black-banner.png","width":300,"height":100,"caption":"steve"},"logo":{"@id":"https:\/\/slapps.fr\/steve\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/slapps.fr\/steve"],"url":"https:\/\/slapps.fr\/steve\/author\/steve\/"}]}},"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/slapps.fr\/steve\/wp-json\/wp\/v2\/posts\/750"}],"collection":[{"href":"https:\/\/slapps.fr\/steve\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/slapps.fr\/steve\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/slapps.fr\/steve\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/slapps.fr\/steve\/wp-json\/wp\/v2\/comments?post=750"}],"version-history":[{"count":1,"href":"https:\/\/slapps.fr\/steve\/wp-json\/wp\/v2\/posts\/750\/revisions"}],"predecessor-version":[{"id":751,"href":"https:\/\/slapps.fr\/steve\/wp-json\/wp\/v2\/posts\/750\/revisions\/751"}],"wp:attachment":[{"href":"https:\/\/slapps.fr\/steve\/wp-json\/wp\/v2\/media?parent=750"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/slapps.fr\/steve\/wp-json\/wp\/v2\/categories?post=750"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/slapps.fr\/steve\/wp-json\/wp\/v2\/tags?post=750"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}