{"id":6524,"date":"2023-03-19T11:58:22","date_gmt":"2023-03-19T11:58:22","guid":{"rendered":"https:\/\/www.modernescpp.com\/index.php\/architectural-patterns\/"},"modified":"2023-03-19T11:58:22","modified_gmt":"2023-03-19T11:58:22","slug":"architectural-patterns","status":"publish","type":"post","link":"https:\/\/www.modernescpp.com\/index.php\/architectural-patterns\/","title":{"rendered":"Architectural Patterns"},"content":{"rendered":"<p>Architectural patterns describe the fundamental structure of a software system and are often based on design patterns. The five Pattern-Oriented Software Architecture series books provide a precious source of architectural patterns.<\/p>\n<p><!--more--><\/p>\n<p>&nbsp;<img loading=\"lazy\" decoding=\"async\" class=\" size-full wp-image-6523\" src=\"https:\/\/www.modernescpp.com\/wp-content\/uploads\/2023\/03\/ArchitecturalPatterns.png\" alt=\"Layers\" width=\"650\" height=\"360\" style=\"display: block; margin-left: auto; margin-right: auto;\" srcset=\"https:\/\/www.modernescpp.com\/wp-content\/uploads\/2023\/03\/ArchitecturalPatterns.png 1236w, https:\/\/www.modernescpp.com\/wp-content\/uploads\/2023\/03\/ArchitecturalPatterns-300x166.png 300w, https:\/\/www.modernescpp.com\/wp-content\/uploads\/2023\/03\/ArchitecturalPatterns-1024x568.png 1024w, https:\/\/www.modernescpp.com\/wp-content\/uploads\/2023\/03\/ArchitecturalPatterns-768x426.png 768w\" sizes=\"auto, (max-width: 650px) 100vw, 650px\" \/><\/p>\n<p>Let me start with the big picture: what is the difference between an architectural pattern, a design pattern, and an idiom?<\/p>\n<h2>Architectural Patterns, Design Patterns, and Idioms<\/h2>\n<p>The main difference between architectural patterns, Design Patterns, and Idioms is their structural categorization based on their scale and abstraction:<\/p>\n<ul>\n<li><strong>Architectural patterns<\/strong> describe the fundamental structure of the entire software system. They are often based on design patterns.<\/li>\n<li><strong>Design patterns<\/strong> define the components&#8217; interaction and focus on subsystems.<\/li>\n<li>An<strong> idiom<\/strong> is implementing an architecture or design pattern in a concrete programming language. The popular idiom in C++ is <strong>R<\/strong>esource <strong>A<\/strong>cquisition <strong>I<\/strong>s<strong> I<\/strong>nitialization (RAII). Container,&nbsp; smart pointers, and locks model them.<\/li>\n<\/ul>\n<p>Let me bring my thoughts about architectural patterns, design patterns, and idioms to the point:<\/p>\n<ul>\n<li>The structural categories go from abstract to concrete. Idioms are the most concrete ones.<\/li>\n<li>They&#8217;re acting on the macro level (architectural patterns), micro-level (design patterns), and programming language (idioms).<\/li>\n<li>Architectural patterns focus on the system, design patterns subsystems, and idioms programming language.<\/li>\n<\/ul>\n<h2>POSA<\/h2>\n<p>The Pattern-Oriented Software Architecture series (POSA) is a precious source of architectural patterns. It consists of five books:<\/p>\n<section class=\"av_textblock_section av-l6ibtytx-bed232652d4f918754a418e480977f17\" itemscope=\"itemscope\" itemtype=\"https:\/\/schema.org\/CreativeWork\">\n<div class=\"avia_textblock\" itemprop=\"text\">\n<ul>\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/Pattern-Oriented_Software_Architecture\"><span id=\"productTitle\" class=\"a-size-extra-large\">Pattern-Oriented Software Architecture, Volume 1<\/span><\/a> by Frank Buschmann, Regine Meunier, Hans Rohnert, Peter Sommerlad, and Michael Stal (POSA 1)<\/li>\n<li><a href=\"https:\/\/www.oreilly.com\/library\/view\/pattern-oriented-software-architecture\/9781118725177\/\"><span id=\"productTitle\" class=\"a-size-extra-large\">Pattern-Oriented Software Architecture, Volume 2<\/span><\/a>: Patterns for Concurrent and Networked Objects) by Douglas C. Schmidt, Michael Stal, Hans Rohnert, and Frank Buschmann&nbsp; (POSA 2)<\/li>\n<li><span id=\"productTitle\" class=\"a-size-extra-large\"><a href=\"https:\/\/www.wiley.com\/en-ie\/Pattern+Oriented+Software+Architecture,+Volume+3,+Patterns+for+Resource+Management-p-9780470845257\">Pattern-Oriented Software Architecture, Volume 3<\/a>: Patterns for Resource Management by Michael Kirchner, and Prashant Jain (POSA 3)<br \/><\/span><\/li>\n<li><span id=\"productTitle\" class=\"a-size-extra-large\"><a href=\"https:\/\/www.wiley.com\/en-us\/Pattern+Oriented+Software+Architecture,+Volume+4,+A+Pattern+Language+for+Distributed+Computing-p-9780470059029\">Pattern-Oriented Software Architecture, Volume 4<\/a>: A Pattern Language for Distributed Programming by Frank Buschmann, Kevlin Henney, and Douglas C. Schmidt (POSA 4)<br \/> <\/span><\/li>\n<li><a href=\"https:\/\/www.wiley.com\/en-us\/Pattern+Oriented+Software+Architecture%2C+Volume+5%2C+On+Patterns+and+Pattern+Languages-p-9780470512579\"><span id=\"productTitle\" class=\"a-size-extra-large\">Pattern-Oriented Software Architecture, Volume 5<\/span><\/a>: Patterns and Pattern Language by Frank Buschmann, Kevlin Henney, and Douglas C. Schmidt (POSA 5)<\/li>\n<\/ul>\n<p>I will present in my posts seven very often used architectural patterns: Layers, Pipes-and-Filters, Broker, Model-View-Controller (MVC), Reactor, Active Object, and Monitor Object.<\/p>\n<p>POSA 1 provides the first classification:<\/p>\n<h3 id=\"h1-3-from-mud-to-structure\">From Mud to Structure<\/h3>\n<p>These patterns provide a controlled decomposition of an overall system task into cooperating subsystems.<\/p>\n<ul>\n<li><strong>Layers<\/strong>: Split a task into layers. Each layer has a specific responsibility and provides a service to a higher layer.<\/li>\n<li><strong>Pipes and Filters<\/strong>: <em>Decompose a task that performs complex processing into a series of separate elements that can be reused. This can improve performance, scalability, and reusability by allowing task elements that perform the processing to be deployed and scaled independently.<\/em> (<a href=\"https:\/\/docs.microsoft.com\/en-us\/azure\/architecture\/patterns\/pipes-and-filters\">https:\/\/docs.microsoft.com\/en-us\/azure\/architecture\/patterns\/pipes-and-filters<\/a>)<\/li>\n<\/ul>\n<h3 id=\"h1-4-distributed-systems\">Distributed Systems<\/h3>\n<p>Build systems whose components are located in different processes or address spaces.<\/p>\n<ul>\n<li><strong>Broker: <\/strong>Structures distributed software systems that interact with remote service invocations. It is responsible for coordinating the communication, its results, and exceptions.<\/li>\n<\/ul>\n<h3>Interactive Systems<\/h3>\n<p>Build a system with human-computer interaction.<\/p>\n<ul>\n<li><strong>Model-View-Controller (MVC)<\/strong>: Divides the program logic of a user interface into the separate components model, view, and controller. The model manages the data and rules of the application. The view represents the data, and the controller interacts with the user.<\/li>\n<\/ul>\n<p>POSA 2 added further classifications:<\/p>\n<h3>Event Demultiplexing and Dispatching<\/h3>\n<p>Initiate, receive, demultiplex, and dispatch events in distributed and network systems.<\/p>\n<ul>\n<li><strong>Reactor<\/strong>: An event-driven application that can accept multiple client requests simultaneously and distribute them to different service providers.<\/li>\n<\/ul>\n<h3>Concurrency Patterns<\/h3>\n<p>Addresses concurrency architecture and design issues for components, subsystems, and applications.<\/p>\n<ul>\n<li><strong>Active Object:<\/strong> Separates the method execution from the method call.<\/li>\n<li><strong>Monitor Object<\/strong>: Synchronizes access to an object so that only one member function can be executed at any time.<\/li>\n<\/ul>\n<h2>What&#8217;s Next?<\/h2>\n<p>After this overview of the POSA books and their pattern, I will present the architectural pattern Layers in my next post.<\/p>\n<p>&nbsp;<\/p>\n<p>{module title=&#8221;Marketing&#8221;}<\/p>\n<p>&nbsp;<\/p>\n<\/div>\n<\/section>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Architectural patterns describe the fundamental structure of a software system and are often based on design patterns. The five Pattern-Oriented Software Architecture series books provide a precious source of architectural patterns.<\/p>\n","protected":false},"author":21,"featured_media":6523,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[379],"tags":[],"class_list":["post-6524","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-patterns"],"_links":{"self":[{"href":"https:\/\/www.modernescpp.com\/index.php\/wp-json\/wp\/v2\/posts\/6524","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.modernescpp.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.modernescpp.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.modernescpp.com\/index.php\/wp-json\/wp\/v2\/users\/21"}],"replies":[{"embeddable":true,"href":"https:\/\/www.modernescpp.com\/index.php\/wp-json\/wp\/v2\/comments?post=6524"}],"version-history":[{"count":0,"href":"https:\/\/www.modernescpp.com\/index.php\/wp-json\/wp\/v2\/posts\/6524\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.modernescpp.com\/index.php\/wp-json\/wp\/v2\/media\/6523"}],"wp:attachment":[{"href":"https:\/\/www.modernescpp.com\/index.php\/wp-json\/wp\/v2\/media?parent=6524"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.modernescpp.com\/index.php\/wp-json\/wp\/v2\/categories?post=6524"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.modernescpp.com\/index.php\/wp-json\/wp\/v2\/tags?post=6524"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}