Software Architecture Basics and Architecture Patterns in Software Engineering (Software Engineering 101)

Erdeniz Tunç
5 min readMar 8, 2024

--

Architecture Introduction

Architecture, in simple terms, is like designing the blueprint for a building. It’s the big picture plan that guides how something will look and function. Just as you wouldn’t start building a house without a blueprint, you wouldn’t start developing a software project without an architecture plan.

Imagine you’re building a house. You need to decide how many rooms you want, where the kitchen will be, how the rooms will connect, and so on. Architecture in software development is similar but instead of rooms, you’re deciding what features your software will have and how they will work together.

Having a good architecture is crucial because it sets the foundation for your project. If you make a mistake in the architecture, it can be very difficult and costly to fix later on. It’s like trying to change the layout of a house after it’s already been built — not impossible, but definitely not easy.

In software development, we often use patterns or templates to help guide our architecture. These patterns help organize the different parts of our project and ensure they work together smoothly. For example, there’s a pattern called “client-server” which is commonly used for websites and apps. It separates the client-side code (what you see and interact with) from the server-side code (where the data is stored and processed).

Architecture Patterns

Pipe-and-Filter

The pipe and filter pattern is a pattern used for processing data. In this pattern, data passes through different filters like a pipe. Each filter performs a specific operation and modifies or processes the data. The key point is that each step takes in and outputs the same type of data. For example, if you send numbers to a filter, you’ll receive numbers on the other side.

This pattern allows you to sequence operations by mixing and matching them while ensuring the program still functions. Additionally, different filters can be set up across multiple servers.

However, this pattern also comes with a disadvantage: its setup can be complex, and data loss at any step can disrupt the process.

Client-Server

The client-server pattern is one that is quite common today. Every single website and most phone apps use this architecture. With this pattern there are two parts to the software, the client, and the server.

When you want to send an email, you use the email client (client software). This is where you write your message and specify the recipient addresses. Then, you send the email you want to send to the server.

Email servers accept incoming emails, facilitate communication between messages, run spam filters, and forward them to recipient servers. The recipient server accepts the email, places it in the inbox, and delivers it to the recipient’s client.

In this example, the email client (client software) allows users to write and send emails, while the server software accepts, processes, and forwards emails to recipient servers. This way, users send emails while servers facilitate data exchange and communication in the background.

Master-Slave

Master-slave pattern consists of a master and the slaves associated with it. This pattern can be used in various applications.

Consider an office scenario: Imagine a main computer and several connected computers in an office. The main computer serves as a central system that stores all the data and manages operations. The slave computers are controlled by the main computer and communicate with it. At a certain time, the main computer signals the slave computers to back up the data. The slave computers receive this instruction and copy the data from the main computer. This way, the data on the main computer is securely backed up.

This pattern can also be used in multi-threaded applications. An operation is divided into multiple small parts, and each part is assigned to a thread. These threads are controlled by a master thread. The master thread monitors the status of each thread and creates or deletes new threads as needed.

This pattern provides centralized control and manages operations efficiently. However, if there is an issue, the main system becoming unavailable can cause all operations to stop.

Layered Pattern

The layered pattern consists of divvying up program into layers of technology. These layers only communicate with adjacent layers. Let’s say we have an architecture with 9 layers. In this model, 8 would only be able to communicate with 9 and 7, 4 with 3 and 5, etc.

This simplifies the communication channels, and helps to better distinguish the areas of the program. Overall, this helps to make the program more maintainable. The downside to this, is that there can be of added complexity in some areas. For example, if you need to send a message from layer 1 to layer 9. There will have to be a function in each layer to pass that message along.

Architecture Conclusion

In conclusion, software architecture serves as the blueprint for designing and organizing software projects, akin to how architectural blueprints guide the construction of buildings. Just as a solid architectural plan is essential for building a house, a well-thought-out software architecture is crucial for the success of a software project.

Architecture patterns, such as the Pipe-and-Filter, Client-Server, Master-Slave, and Layered patterns, provide templates and guidelines for organizing the different components of a software system. These patterns help ensure smooth integration of features and efficient data processing, while also facilitating maintainability and scalability.

However, each architecture pattern comes with its own set of advantages and disadvantages. For instance, while the Pipe-and-Filter pattern allows for flexible data processing, it may introduce complexity and potential data loss. Similarly, the Client-Server pattern enables efficient communication between clients and servers, but it requires careful management of client-server interactions.

Ultimately, selecting the appropriate architecture pattern depends on the specific requirements and constraints of the software project. By carefully considering these factors and iteratively refining the architecture, software engineers can build robust and scalable software systems that meet the needs of users and stakeholders.

--

--