{"id":6420,"date":"2022-08-08T20:17:45","date_gmt":"2022-08-08T20:17:45","guid":{"rendered":"https:\/\/www.modernescpp.com\/index.php\/classification-of-patterns-2\/"},"modified":"2022-08-08T20:17:45","modified_gmt":"2022-08-08T20:17:45","slug":"classification-of-patterns-2","status":"publish","type":"post","link":"https:\/\/www.modernescpp.com\/index.php\/classification-of-patterns-2\/","title":{"rendered":"Classification of Patterns"},"content":{"rendered":"<p>In my last post, I presented the classification of design patterns based on the seminal book &#8220;<a href=\"https:\/\/en.wikipedia.org\/wiki\/Design_Patterns\">Design Patterns: Elements of Reusable Object-Oriented Software&#8221;<\/a>. Today, I present are more general classification of patterns based on the second seminal book <a href=\"https:\/\/en.wikipedia.org\/wiki\/Pattern-Oriented_Software_Architecture\">&#8220;<span id=\"productTitle\" class=\"a-size-extra-large\">Pattern-Oriented Software Architecture, Volume 1<\/span><\/a>&#8220;.<\/p>\n<p><!--more--><\/p>\n<p>&nbsp;<img loading=\"lazy\" decoding=\"async\" class=\" size-full wp-image-6412\" src=\"https:\/\/www.modernescpp.com\/wp-content\/uploads\/2022\/07\/classification.png\" alt=\"classification\" width=\"650\" height=\"330\" style=\"display: block; margin-left: auto; margin-right: auto;\" srcset=\"https:\/\/www.modernescpp.com\/wp-content\/uploads\/2022\/07\/classification.png 1233w, https:\/\/www.modernescpp.com\/wp-content\/uploads\/2022\/07\/classification-300x152.png 300w, https:\/\/www.modernescpp.com\/wp-content\/uploads\/2022\/07\/classification-1024x520.png 1024w, https:\/\/www.modernescpp.com\/wp-content\/uploads\/2022\/07\/classification-768x390.png 768w\" sizes=\"auto, (max-width: 650px) 100vw, 650px\" \/><\/p>\n<p>You may have already noticed it. The classification in my last post, &#8220;<a href=\"https:\/\/www.modernescpp.com\/index.php\/classification-of-patterns\">Classification of Design Patterns<\/a>&#8221; was about design patterns, but this post, &#8220;Classification of Patterns&#8221; is about patterns. This is intentional because the classification of &#8220;<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>&#8221; (short POSA 1) is more general than the one of&nbsp;&#8220;<a href=\"https:\/\/en.wikipedia.org\/wiki\/Design_Patterns\">Design Patterns: Elements of Reusable Object-Oriented Software&#8221;<\/a>. To make it short, today&#8217;s classification includes the last one.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Pattern-Oriented_Software_Architecture_Volume_1\"><\/span>Pattern-Oriented Software Architecture, Volume 1<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Here is the big picture of the patterns presented in POSA 1.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\" size-full wp-image-6419\" src=\"https:\/\/www.modernescpp.com\/wp-content\/uploads\/2022\/08\/posa_1.png\" alt=\"posa1\" width=\"650\" height=\"403\" style=\"display: block; margin-left: auto; margin-right: auto;\" srcset=\"https:\/\/www.modernescpp.com\/wp-content\/uploads\/2022\/08\/posa_1.png 1144w, https:\/\/www.modernescpp.com\/wp-content\/uploads\/2022\/08\/posa_1-300x186.png 300w, https:\/\/www.modernescpp.com\/wp-content\/uploads\/2022\/08\/posa_1-1024x636.png 1024w, https:\/\/www.modernescpp.com\/wp-content\/uploads\/2022\/08\/posa_1-768x477.png 768w\" sizes=\"auto, (max-width: 650px) 100vw, 650px\" \/><\/p>\n<p>POSA 1 uses two ways of classification. It classifies the patterns based on their structural category and their problem category. Before I dive into the two classifications, let me write a few words about the patterns in the table, written in bold letters.<\/p>\n<p>I will write about all patterns written in bold letters. The design patterns proxy, publish-subscriber, and counted pointer are particular. Proxy is already part of the book &#8220;<a href=\"https:\/\/en.wikipedia.org\/wiki\/Design_Patterns\">Design Patterns: Elements of Reusable Object-Oriented Software&#8221;<\/a> and publish-subscriber is quite similar to the observer pattern that is also part of the already mentioned book. Additionally, you should already know and use the counter pointer idiom. In C++11, we call it <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/memory\/shared_ptr\"><code>std::shared_ptr<\/code><\/a>.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Structural_Categories\"><\/span>Structural Categories<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Structural categorization is a categorization 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 an implementation of 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 have the system, design patterns subsystems, and idioms programming language in focus.<\/li>\n<\/ul>\n<p>Let&#8217;s focus on the different problem categories.<\/p>\n<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Problem_Categories\"><\/span>Problem Categories<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>&#8220;<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>&#8221; has ten different problem categories. I will present them and their patterns compactly before diving deeper into upcoming posts in a few of them.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"From_Mud_to_Structure\"><\/span>From Mud to Structure<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>They 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<li><strong>Blackboard: <\/strong>Several specialized subsystems assemble their knowledge to build a possible partial solution. It is used for problems for which no deterministic solution is known. <strong><br \/><\/strong><\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"Distributed_Systems\"><\/span>Distributed Systems<span class=\"ez-toc-section-end\"><\/span><\/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><span class=\"ez-toc-section\" id=\"Interactive_Systems\"><\/span>Interactive Systems<span class=\"ez-toc-section-end\"><\/span><\/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<li><strong>Presentation-Abstraction-Controller (PAC)<\/strong>: is similar to the MVC. In contrast to the MVC, the PAC has a hierarchical structure of agents, each agent consisting of a presentation, abstraction, and control parts.<\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"Adaptable_Systems\"><\/span>Adaptable Systems<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Make an application extensible and adaptable to new requirements.<\/p>\n<ul>\n<li><strong>Microkernel<\/strong>: Separates a minimal functional core from extended functionality.<\/li>\n<li><strong>Reflection<\/strong>: Splits a system into two parts: a meta level and a base level. The meta level supports system properties and makes it self-aware. The base level includes the application logic.<\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"Structural_Decomposition\"><\/span>Structural Decomposition<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>They decompose systems into subsystems and complex components into suitably cooperating components.<\/p>\n<ul>\n<li><strong>Whole-Part<\/strong>: Builds an aggregation of components to provide the whole out of its parts. It provides a common interface for the parts. This design pattern is similar to the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Composite_pattern\">composite pattern<\/a> from the book &#8220;<a href=\"https:\/\/en.wikipedia.org\/wiki\/Design_Patterns\">Design Patterns: Elements of Reusable Object-Oriented Software&#8221;<\/a>.<\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"Organization_of_Work\"><\/span>Organization of Work<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Cooperates several components to offer a complex service.<\/p>\n<ul>\n<li><strong>Master-Slave<\/strong>: The master distributes its work to his slaves and collects the results from them.<\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"Access_Control\"><\/span>Access Control<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Protects and controls access to services and components:<\/p>\n<ul>\n<li><strong>Proxy<\/strong>: It is a wrapper that the client is calling to access the real object. A proxy typically adds additional logic such as caching, security, or encryption. This additional logic is hidden from the client.<\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"Management\"><\/span>Management<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Handle homogeneous sets of objects, services, and components in their entirety.<\/p>\n<ul>\n<li><strong>Command Processor<\/strong>: Embodies commands into objects, such that their execution can be scheduled, stored, or later be undone.&nbsp;<\/li>\n<li><strong>View Handler<\/strong>: &#8230; <em>helps to manage all views that a software system provides. A view handler component allows clients to open, manipulate and dispose of views. It also coordinates<br \/>dependencies between views and organizes their update.<\/em> (<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>)<\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"Communication\"><\/span>Communication<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Organizes communication between components.<\/p>\n<ul>\n<li><strong>Forwarder-Receiver<\/strong>: <em>Provides transparent interprocess communication for software systems with a peer-to-peer interaction model. It introduces forwarders and receivers to decouple peers from the underlying communication mechanisms.<\/em>(<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>)<\/li>\n<li><strong>Client-Dispatcher-Server<\/strong>: Introduces the dispatcher as a layer between clients and servers. The dispatcher provides transparency between the clients and the servers.<\/li>\n<li><strong>Publish-Subscriber<\/strong>: Enables the publisher to automatically notifies all subscribers. This design pattern is similar to the <a href=\"https:\/\/refactoring.guru\/design-patterns\/observer\">observer pattern<\/a> from the book &#8220;<a href=\"https:\/\/en.wikipedia.org\/wiki\/Design_Patterns\">Design Patterns: Elements of Reusable Object-Oriented Software&#8221;<\/a>.<\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"Resource_Management\"><\/span>Resource Management<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Help to manage shared components and objects.<\/p>\n<ul>\n<li><strong>Counted Pointer<\/strong>: Introduces a reference counter for dynamically-allocated shared objects. <a href=\"https:\/\/en.cppreference.com\/w\/cpp\/memory\/shared_ptr\"><code>std::shared_ptr<\/code><\/a> is the prominent example in C++.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Whats_next\"><\/span>What&#8217;s next?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>This post ends my introduction to patterns. In my next post, I present a pattern structure based on &#8220;<a href=\"https:\/\/en.wikipedia.org\/wiki\/Design_Patterns\">Design Patterns: Elements of Reusable Object-Oriented Software&#8221;<\/a>.<\/p>\n<p>&nbsp;<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In my last post, I presented the classification of design patterns based on the seminal book &#8220;Design Patterns: Elements of Reusable Object-Oriented Software&#8221;. Today, I present are more general classification of patterns based on the second seminal book &#8220;Pattern-Oriented Software Architecture, Volume 1&#8220;.<\/p>\n","protected":false},"author":21,"featured_media":6412,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[379],"tags":[],"class_list":["post-6420","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\/6420","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=6420"}],"version-history":[{"count":0,"href":"https:\/\/www.modernescpp.com\/index.php\/wp-json\/wp\/v2\/posts\/6420\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.modernescpp.com\/index.php\/wp-json\/wp\/v2\/media\/6412"}],"wp:attachment":[{"href":"https:\/\/www.modernescpp.com\/index.php\/wp-json\/wp\/v2\/media?parent=6420"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.modernescpp.com\/index.php\/wp-json\/wp\/v2\/categories?post=6420"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.modernescpp.com\/index.php\/wp-json\/wp\/v2\/tags?post=6420"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}