Architectural patterns describe the basic structure of a software system and are often based on design patterns. The five books from the “Pattern-Oriented Software Architecture” series provide valuable information and suggestions on the subject of architectural patterns.
Rainer Grimm has been working as a software architect, team leader and training manager for many years. He likes to write articles on the programming languages C++, Python and Haskell, but also likes to speak frequently at specialist conferences. On his blog Modernes C++ he deals intensively with his passion for C++.
Let’s start with a classifying overview: How do architectural patterns, design patterns and idioms differ?
Architectural patterns, design patterns and idioms
The key difference between architectural pattern, design pattern, and idiom lies in the structural categorization based on their scope and level of abstraction:
- Architekturmuster describe the basic structure of the entire software system. They are often based on design patterns.
- design pattern define the interaction of the components and focus on subsystems.
- A Idiom is an implementation of an architecture or design pattern in a concrete programming language. One of the most popular idioms in C++ is Resource Acquisition Is Initialization (RAII). They are represented by containers, smart pointers and locks.
I’d like to summarize my thoughts on architectural patterns, design patterns, and idioms:
- The structural categories range from abstract to concrete. Idioms are the most concrete.
- They work on the macro level (architectural patterns), the micro level (design patterns) and the programming language (idioms).
- Architectural patterns focus on the system, design patterns on the subsystems, and idioms on the programming language.
POSA – Pattern-Oriented Software Architecture
The Pattern-Oriented Software Architecture (POSA) five-part book series is a valuable resource on architectural patterns:
- Pattern-Oriented Software Architecture, Volume 1 by Frank Buschmann, Regine Meunier, Hans Rohnert, Peter Sommerlad and Michael Stal (POSA 1)
- Pattern-Oriented Software Architecture, Volume 2: Patterns for Concurrent and Networked Objects von Douglas C. Schmidt, Michael Stal, Hans Rohnert und Frank Buschmann (POSA 2)
- Pattern-Oriented Software Architecture, Volume 3: Patterns for Resource Management by Michael Kirchner and Prashant Jain (POSA 3)
- Pattern-Oriented Software Architecture, Volume 4: A Pattern Language for Distributed Programming by Frank Buschmann, Kevlin Henney, and Douglas C. Schmidt (POSA 4)
- Pattern-Oriented Software Architecture, Volume 5: Patterns and Pattern Language by Frank Buschmann, Kevlin Henney, and Dougles C. Schmidt (POSA 5)
As part of this article, I will present the seven most commonly used architectural patterns in a compact form: Layers, Pipes and Filters, Broker, Model View Controller (MVC), Reactor, Active Object and Monitor Object.
POSA 1 provides a first classification.
From (original) mud to structure
The following patterns enable a controlled decomposition of an overall system task into cooperating subsystems.
- layered architecture: Break down a task into layers. Each layer has a specific responsibility and provides a service to a higher layer.
- Pipes and Filters: Decompose a task designed to perform complex processing into a set of separate elements that can be reused. This can improve performance, scalability, and reusability because the work items that perform the processing can be deployed and scaled independently.
The broker pattern can be used to create systems whose components are located in different processes or address spaces.
- Broker: Structures distributed software systems that interact with remote service calls. He is responsible for coordinating communications, their outcomes and exceptions.
Build a system with human-computer interaction.
- Model-View-Controller (MVC): Divides the program logic of a user interface into the individual components model, view and controller. The model manages the data and rules of the application. The view renders the data and the controller interacts with the user.
Additional classifications are added in POSA 2:
Event-Demultiplexing und Dispatching
Initiating, receiving, demultiplexing and sending events in distributed and network systems.
- Reactor: An event-driven application that can accept multiple client requests at the same time and distribute them to different service providers.
Addresses issues of concurrent architecture and component, subsystem, and application design.
- Active Object: Separates method execution from method invocation.
- Monitor Object: Synchronizes access to an object so that only one member function can be running at any one time.
After this first overview of the POSA books and the patterns covered in them, I will present the architectural pattern Layers in more detail in my next article.