My minimalist training method

During the confinement, hundreds of coaches were seen on YouTube or elsewhere improvising weight training programs without equipment. Basically, I was just tired of having to wait in front of a…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




An overview of Software Architecture Patterns

Due to the constant evolution of technology and business expectations, the complexity of software solutions is becoming more intense. Software architecture comes into to reduce the increasing complexity and change of software. Hence the contribution of architecture patterns to create software architectures that are easy to implement, resistant, and versatile. If we refer to the field of software engineering, there are several architecture patterns. These architecture patterns, however, can be used to solve the problems that architects, software developers, and integrators face in the practice of their profession.

In this blog we will firstly define the software architecture patterns and then we will examine several selected specific architecture patterns including their advantages and disadvantages. As a more detailed example we’ll go deeper into the topic of the pipes and filters pattern. With support of graphics we will explain how exactly it works and we give examples for it’s sensible use in known systems. Then we will illustrate the benefits of software architecture patterns and finally we’re going to close with an outlook.

I - What is a software architecture pattern?

II - Common software architecture patterns and examples

III - Benefits of software architecture patterns

IV - Outlook

Imagine that you are planning the creation of a software system. To carry out the project, it is important to choose a suitable software architecture pattern that will bring you better results and allow you to reach the set objectives. But also choosing the reciprocal software architecture pattern is not easy, not only it must match the conditions, reduce costs, allow easy integration and maintenance of the system. Also, it must allow developing a more flexible, scalable, and reusable system in the future. Furthermore, it will have to continuously face future trends.

From this definition, it follows that software architecture patterns help in the development, maintenance, and handling of complex software systems. They also contribute to improved decision making in software development. Like we said before, it is important to choose a suitable software architecture pattern that can provide the desired functionality to achieve the goals set by an organization.

In general, there are several formats for describing architecture patterns. Below we will describe some of the elements that can be found in most patterns:[3]

Name: The name is used to identify the pattern.

Context: The context illustrates the preconditions under which the pattern can be applied.

Problem: The aim here is to describe the problem and shed light on the objective to be achieved in this context.

Solution: The point here is to explain how the goal is to be achieved. It can be done through an explicit description allowing the identification of the static structure of the solution and it’s dynamic behavior.

The following common architecture patterns will be explained:

2. Broker Pattern

3. Blackboard Pattern

4. Client-Server Pattern

5. Peer-to-Peer Pattern

6. Pipes and Filters Pattern

7. Model-View-Controller (MVC)

8. Microkernel Pattern

9. Microservices Pattern

We’re going to start with the layered pattern which is widely used in software engineering. With the evolution of technology, it is important to develop systems that are easy to modify and reuse. For this purpose, the modules of the system must be designed and maintained independently, however, there may be a small communication among them. The layered pattern allows developing systems with separate modules. The system should be divided into layers and each layer is made up of modules that are packed with a set of services[3]. There is a certain relationship between the layers, based on a strict rule that requires a certain order. For example, the upper layer depends on the lower layer and not the other way around[4]. When we speak about layers, we can refer to the OSI-7 layer model which is very known. As far as the implementation of this pattern is concerned, there is no recommendation on the type and number of layers to use[4]. Some examples of known layers are:[4]

Presentation layer: The Layer is in charge of managing all user interfaces and browser communication logic.

Business Layer: This layer is concerned about executing distinguishing business rules belonging to the requests.

Persistence Layer: The persistence layer grants to save and return the elements that the application uses.

Data Access Layer: The data access layer disconnects the storage and retrieval of data from it’s representation.

The layered pattern is used for instances for e-commerce applications and cloud computing.

This pattern has some advantages:[4]

There are a few disadvantages too as follows:[4]

In those layers of the layered pattern one could implement the pipes and filters pattern for transforming the data. The layered pattern might be the most common software architecture pattern. It is also known as N-Tier pattern.

Some systems are nowadays very complex and spread over several servers. This makes it difficult for developers to implement the system, as they don’t know how the different components communicate with each other. They also wonder about the types of protocols and hardware used. The broker acts as a middleman among clients and services. The broker pattern is used to design distributed software systems and it is composed of different components such as: [3]

Server: The server affords services.

Clients: The client asks the intermediary for services.

Intermediary: The intermediary is also called “broker” and handles the communication between the client and the server.

Client-Side Proxy: The client-side proxy is also a middleman that handles the interaction with the broker, for instances and memory management.

Server-Side Proxy: The server-side proxy plays the same role as the client-side proxy.

Bridge: The bridge helps to cover the process among several brokers.

The broker pattern provides a platform transparency, each service can be run on different platforms. It provides location transparency, because the the broker takes care of locating the servers and also supports remote communication[3]. Components are easy to change and reuse. However, several components are involved in the implementation of the broker pattern, which makes testing difficult. Low fault tolerance can also occur in comparison to non distributed software systems[3].

Illustration 3 shows in an easy visualization how the pattern works and what the broker actually does. The client sends a request to the intermediate broker and the broker locates the sensible server. In case there is no server in the broker’s registry the broker would request the bridge for external broker systems to locate a corresponding server.

Illustration 3 — Broker Pattern [1][14]

The blackboard architecture pattern is required for systems that have no decisive solution strategy[5]. It is used for speech recognition or autonomous vehicle navigation systems. The Pattern is based on three components: [2]

Blackboard: The blackboard is a central data store with a vocabulary. The vocabulary covers a set of elements that appear on the blackboard. It receives input in a continous stream and notifies the controller about the incoming data. Besides, the blackboard behaves as an interface for sources of knowledge to read from or write in. [15]

Controller: The controller covers modifications commonly and enrolls the accomplishment of knowledge source in time of getting notified about the incoming data. [15]

Knowledge-Sources: Knowledge-sources are autonomous sub-systems that are carried out individually. They explain the part of the whole problem and try to solve it. They send the partial solved problem data back to the blackboard, which starts the whole process again until the last update has brought the solution. [15]

The blackboard architecture pattern enables a unique method for accessing critical data; unreliable data access is easy to recognize[6]. There is no direct, unchecked connection to the data and modification is easier to make[6]. Nevertheless, access to data takes longer[6].

Illustration 3 shows the process of the Blackboard Pattern.

Illustration 4— Blackboard Pattern [1][16]

The client-server pattern allows to structure components like shared files and services linked to a system, while allowing the client to have an easy access to them[3]. There are two types of components such as client and server which are connected through a request/response protocol[3]. The client asks for a service through a request to the server, then the server sends a response to the client. It is used for example by e-commerce websites and messaging systems.

The pattern has many advantages:[3]

Nevertheless, the server can fail and lead to a network-wide failure because the entire network is built around the server.

Peer-to-peer has been around for years and was used for illegal downloading. But with the realease of blockchain and bitcoin, its importance has grown again. Peer-to-Peer defines a model of a peer-to-peer computer network between computers that distribute and receive data or files[3]. In this type of network, comparable to the client-server network, each client becomes a server itself. Peer-to-Peer pattern facilitates and accelerates exchanges between several computers within a network.

One of the most common uses of peer-to-peer pattern is file sharing[8]. A client that owns a file makes it available to other clients via a download platform. It can also simultaneously download other files shared by other clients (servers). The downloaded file snippets are immediately shared with other computers until the file is complete. This technique increases the download speed and reduces the load on the central server.

Peer-to-Peer pattern has some advantages:[7]

And also some disadvantages such as:[7]

Illustration 6 — Peer-to-Peer Pattern [1]

Imagine your water that’s coming from your water tap at home. This water is the output data of a long data stream. Before the water reached you, it has crossed many pipes and filters. The filters might have been for cleaning or heating the water and the pipes are the transportation element to bring it from the input to the filters, from filter to filter and from the filters to your water tap. And that’s how the pipes and filters pattern is working.

The pipes and filters pattern is a pattern for stream processing. It is usually used for those systems whereby the need to process a stream of data. The pipes and filters pattern has two components namely pipes and filters. The pipes carry data between adjacents filters and filters perform complex processing into separate elements that can be reused[3]. So filters usually do processing steps. Beyond that, the command interpreter and many tools of the Unix Operating System are built according to the pipes and filters pattern[2].

Pipes and Filters allow flexibility by replacing and adding new filters. It also allows the reuse of individual filters and intermediate files are not as necessary as desired[3]. But unfortunately the costs of data transfer between the filters can be very high, depending on the pipe[3]. This might cause a poorer performance. Besides, unnecessary data transformations between the individual filter stages are often seen, and error handling across filter stages is sometimes difficult[3]. This can lead to errors passing the pipes.

For a better understanding we will just give some visual examples. As you can see in illustration 7, the input data gets piped to filter A, there the data gets transformed, afterwards it gets piped to filter B, the data gets transformed in a different way than in filter A, and finally the data has become the desired output. This might be the easiest way to illustrate.

Illustration 8 shows the multiple use of filters. Different data inputs can use the same filters and result in two data outputs. Also a reuse of filters within one pipeline from input to output data is possible.

Illustration 8— Pipes and Filters Pattern, Example 2 [1]

But two inputs does not mean to have two outputs. You could have as many input as the dataset needs and end in just one output; as shown in illustration 9.

For a better understanding: Imagine you bought cucumbers and tomatos for making a salad. To get rid of the toxic layer you wash the vegetables. After that you cut it to pieces and add it to the salad. Illustration 10 shows you the practical working of the theoretical illustration 9.

Illustration 10 — Pipes and Filters Pattern, Example 4 [1]

It’s sensible to use the pipes and filters pattern for systems with large processes that can be split into multiple steps. For example every image editing software like Adobe Photoshop or the open source software Gimp: The original image is the input data and the filters might be a sharpener or a scaler or a rotator. Illustration 11 gives a visual view of the process. And you will notice: Filters can be reused as much as needed.

MVC Pattern is used to develop, maintain and perform systems with a graphical user interface. It allows to create responsive design and it helps for individual modification and reuse of components. The pattern consists of three components:[3]

Model: The model is in the charge of the data structure of the application.

View: The view is a component of the user interface and affords a description of the model for the user.

Controller: The controller controls the interaction among the model and the view.

Below the diagram shows an overview of the model view controller. In this illustration the view shows data to the user and allows the user to interact with the controller. The controller deals with the model and the model in turn allows the view to be updated.

Illustration 12— Model-View-Controller Pattern [1][5]

The model view controller pattern allows the same data model to be represented in several views[5]. Furthermore, all views that refer to one model are automatically synchronized and control elements can be swapped as desired. It is also possible to implement a new view on an existing model. Thus such a system is almost arbitrarily scalable[5].

One disadvantage is that accessing a model from multiple views can quickly lead to a high level of complexity, which makes it more difficult to locate faulty parts of the system[3]. The strong dependency between model and controller can also be interpreted as a disadvantage.

This pattern could be combined with the layered pattern.

The microkernel architecture pattern is also known as a plug-in architectural pattern[5]. The microkernel pattern allows adding custom services and functionality without having to modify the whole system. It is used when we create systems with interchangeable components and mainly for the creation of software applications and webbased systems[5]. Besides, the pattern embraces a core of system logic and functionality. There are two components involved in the microkernel architecture pattern such as:[9]

Core system: The core system of the microkernel architecture pattern has the minimum functionalities necessary to operate the system.

Extensions: The are different kinds of extensions like internal servers, external servers, adapters and clients. They are used to add additional functionalities to build different versions of a system. They are also independent of each other.

One advantage of the microkernel architecture pattern is the extensibility. It is easy to integrate and extend a system with new plug-ins for example [10]. It allows to make changes in a system without affecting the whole system because the rules are divided into plug-in components. It is also easier to test because the individual modules can be tested in isolation. But the design and implementation of robust systems lead to more complexity. And also there is a lot of inter-process communication in such a system.

Illustration 13 — Microkernel Pattern [1]

We have seen that these software architecture patterns make it very easy to develop and test software systems. However, most of the components interact with each other, so there is a certain dependency. The implementation of these patterns makes systems very complex and slow, so it becomes difficult to better understand the system in case of any change in the system. Some structures allow to separate modules and these modules play different roles in the system, which makes it difficult to scale the system. Microservices are a new modern software architecture pattern that helps to solve these issues.

In recent years the topic of microservices has become popular as more companies want to work more agile. The microservices pattern is a further development of service-oriented architecture and enables the development of an application as a collection of small services that all run in a separate process and can be used individually[10]. The main service components are services. They are independent and could be distributed over a network, in one place or somewhere else.

Functionality and operations are accomplished by communicating with service components through messaging mechanisms such as rest, soap, etc. Service components also communicate using an event-driven approach by producing and receiving a message or event[10]. All service components talk to the same database and they use some topologies. There are a lot of topologies, but the common uses are :[12]

To better understand the concept, let us take the example of Uber, a carpooling site that has gone from a platform with monolithic functionalities to a platform based on microservices. Due to its expansion around the world, the system required more scalability and continuous development [13].

Illustration 14 — Microservice Architecture of Uber [13]

As we can see in this new platform, individual microservices have been created for each function, such as passenger management, driver management, and trip management, etc.[13]. Besides, these microservices are connected by an API Gateway[13]. The platform is fragmented in independent services, that can be built, maintain, and deploy independently.

The pattern has some advantages and disadvantages like other patterns. Microservices pattern is the default architecture pattern in the cloud and provide scability and extensibility of applications, only the required systems are scaled. The system is fragmented in independent services that can build, maintain and deploy independently[12]. However, there is increased latency, due to the large number of distributed small services. Transactions and monitoring are difficult to handle because of the complexity of the pattern [12].

Software Architecture Patterns help to define several components, classes, objects in-depth, including their responsibility relationships and interaction[2]. All these components as a whole help to describe a problem related to an application. Because it is not easy for a simple application to detect these problems itself. Also, these patterns highlight the different roles that all these components play because each of them has a specific role and a responsibility to provide a solution.

For example the broker pattern describes several components that interact with each other. This is the case of the broker that acts as an intermediary among client and server.

Moreover, software architecture patterns allow developing applications according to the requirements of a company, the users, the developer. Pattern provide mechanisms to help better develop and maintain an application.

Let’s take the example of the layered schema which allows developing software with independent parts from each other. This makes it easy to make changes without affecting the whole system.

Furthermore, software architecture patterns are used to document software architectures. With their help, you can describe your ideas for the design of the software system.

Imagine that a system has been developed with a broker pattern, when a change is made, it is easy through the documentation to know how the software has been structured taking into account any functionalities related to the system. In our case, we can learn about the components of the broker pattern and their role in the system, before making any change. Pattern helps to resolve conflicts that may arise and helps developers focus on key design decisions.

In summary, software architecture patterns are very important for creating flexible systems that respond to individual user needs and changing conditions, and help manage the complexity of software systems. They also allow reducing costs related to the development and maintenance of a software, as the systems are more adaptable, scalable and reusable.

We explained multiple software architecture patterns, including their advantages and disadvantages. It is also possible to mix several of these patterns. Although there are several other patterns in addition to those mentioned above. It is important to remember that all these Patterns are solutions to put in evidence in the implementation of an application. Notwithstanding it is important to clearly understand the context, the advantages, and disadvantages of these patterns before applying them. Ask yourself if the pattern the right choice for the project is? Identify the main functionality of the application.This helps to avoid applying the wrong pattern which will lead to problems later on.

We hope that this blog will guide you in your architectural journey. Please check our sources if you want to know more about software architecture patterns and leave comments if you have any questions, we will be happy to answer them.

[1] The illustrations 1–13 are own creations; some marked illustrations are based on other sources

[2] R. M. H. R. P. S. S. Frank Buschmann, Pattern-orientierte Software-Architektur, ADDISON-Wesley, 1998.

[3]P. C. R. K. Len Bass, Software Architecture in practice third Edition, Upper Saddle River, NJ, Boston , Indianapolis, San Francisco: Addison-Wesley, 2015.

[4] https://www.oreilly.com/library/view/software-architecture-patterns/9781491971437/ch01.html

[5] Edward Lavieri, Hands-on Design Patterns with Java: Learn design patterns that enable the building of large-scale software architectures, Packt Publishing, 2019.

[7] https://www.sciencedirect.com/topics/computer-science/peer-to-peer-architectures

[8] http://www-vs.informatik.uni-ulm.de/teach/ss05/vp/Ausarbeitung/Wilhelm%20Eisenschmid%20-%20P2P-Architekturen.pdf

[9]https://www.oreilly.com/library/view/software-architecture-patterns/9781491971437/ch03.html

[10]D. Takai, „Architektur für Websysteme: Serviceorientierte Architektur, Microservices, Domänengetriebener Entwurf,“ München, Carl Hanser Verlag, 2017.

[11]https://microservices.io/patterns/microservices.html

[12] https://www.oreilly.com/library/view/software-architecture-patterns/9781491971437/ch04.html

[13]https://blog.dreamfactory.com/microservices-examples/

[14] Patrick Morrison and Eduardo B. Fernandez, Securing the Broker Pattern in Dept. of Computer Science & Engineering

[15] Stefan Kleine Stegemann, Burkhardt Funk and Thomas Slotos, A Blackboard Architecture for Workflows, Universität Lüneburg

Add a comment

Related posts:

You Have More in Common with a House Plant than You Think

Whenever people around me talk to each other as though I wasn’t there, I use a line to get their attention I learned long ago, “What am I? A Potted Plant?”. Brendan V. Sullivan, attorney for Marine…

Why Laughter Really Is The Best Medicine For Your Mental Health Right Now

Belly-aching chortles; reflex guffaws; contagious giggles. It sure does feel good to hear a peal of laughter. A heart-warmingly infectious element of the human condition, laughter is widely know to…

Urban Go usability optimization

UrbanGo is a fictional mobile app proposing to solve urban mobility problems by offering users the fastest and cheapest public and private transport routes. However, there is one point for many…