Docsity

Software Architecture: Principles, Patterns, and Design, Lecture notes of Object Oriented Analysis and Design

Toggle sidebar
bg1
CHAPTER - SIX
Software architecture
Architecture plays a central role in building construction. A building’s architecture is described
using a set of plans that, taken together, represent all aspects of the building. It describes the
building from such viewpoints as electricity, plumbing, structure, etc.
The architect is the person in charge of the whole project. He or she has the responsibility to
make sure that the building will be solid, cost-effective and satisfactory to the client. Software
architecture is similar. It plays a central role in software engineering, and involves the
development of a variety of high-level views of the system. Furthermore, individuals called
software architects often lead a team of other software engineers.
The term ‘software architecture’ is also applied to the documentation
produced as a result of the process. For clarity, this documentation is often also
called the architectural model.
Definition: software architecture is the process of designing the global organization of a
software system, including dividing software into subsystems, deciding how these will interact,
and determining their interfaces.
The importance of developing an architectural model
Software engineers discuss all aspects of a system’s design in terms of the architectural model.
Decisions made while this model is being developed therefore have a profound impact on the
rest of the design process. The architectural model is the core of the design; therefore all
software engineers need to understand it.
The architectural model will often constrain the overall efficiency, reusability and
maintainability of the system. Poor decisions made while creating this model will constrain
subsequent design.
There are four main reasons why you need to develop an architectural model:
■ To enable everyone to better understand the system. As a system becomes more and more
complex, making it understandable is an increasing challenge. This is especially true for large,
distributed systems that use sophisticated technology.
■ To allow people to work on individual pieces of the system in isolation. The work of
developing a complex software system must be distributed among a large number of people.
The architecture allows the planning and coordination of this distributed work. The architecture
should provide sufficient information so that the work of the individual people or teams can
later on be integrated to form the final system
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download Software Architecture: Principles, Patterns, and Design and more Lecture notes Object Oriented Analysis and Design in PDF only on Docsity!

CHAPTER - SIX

Software architecture

Architecture plays a central role in building construction. A building’s architecture is described using a set of plans that, taken together, represent all aspects of the building. It describes the building from such viewpoints as electricity, plumbing, structure, etc.

The architect is the person in charge of the whole project. He or she has the responsibility to make sure that the building will be solid, cost-effective and satisfactory to the client. Software architecture is similar. It plays a central role in software engineering, and involves the development of a variety of high-level views of the system. Furthermore, individuals called software architects often lead a team of other software engineers.

The term ‘software architecture’ is also applied to the documentation produced as a result of the process. For clarity, this documentation is often also called the architectural model.

Definition: software architecture is the process of designing the global organization of a software system, including dividing software into subsystems, deciding how these will interact, and determining their interfaces.

The importance of developing an architectural model

Software engineers discuss all aspects of a system’s design in terms of the architectural model. Decisions made while this model is being developed therefore have a profound impact on the rest of the design process. The architectural model is the core of the design; therefore all software engineers need to understand it.

The architectural model will often constrain the overall efficiency, reusability and maintainability of the system. Poor decisions made while creating this model will constrain subsequent design.

There are four main reasons why you need to develop an architectural model: ■ To enable everyone to better understand the system. As a system becomes more and more complex, making it understandable is an increasing challenge. This is especially true for large, distributed systems that use sophisticated technology. ■ To allow people to work on individual pieces of the system in isolation. The work of developing a complex software system must be distributed among a large number of people. The architecture allows the planning and coordination of this distributed work. The architecture should provide sufficient information so that the work of the individual people or teams can later on be integrated to form the final system

■ To prepare for extension of the system. With a complete architectural model,it becomes easier to plan the evolution of the system. Subsystems that are envisioned to be part of a future release can be included in the architecture, even though they are not to be developed immediately. It is then possible to see how the new elements will be integrated, and where they will be connected to the system.

■ To facilitate reuse and reusability. The architectural model makes each system component visible. This is an important benefit since it encourages reuse. By analyzing the architecture, you can discover those components that can be obtained from past projects or from third parties.

Contents of a good architectural model

A system’s architecture will often be expressed in terms of several different views. These can include:

■ The logical breakdown into subsystems. This is often shown using package diagrams, which we will describe later. The interfaces among the subsystems must also be carefully described. ■ The dynamics of the interaction among components at run time, perhaps expressed using interaction or activity diagrams. ■ The data that will be shared among the subsystems, typically expressed using class diagrams. ■ The components that will exist at run time, and the machines or devices on which they will be located. This information can be expressed using

How to develop an architectural model

The system’s architecture must take its overall shape very early in the design process, although it will continue to mature as iterative development proceeds. The basis for the architectural model will be the system domain model and the use cases. The first draft of the architectural model should be created at the same time as these. These give the architect an idea about which components will be needed and how they will interact. At the same time, the early architecture will give use case modelers guidance about the steps the user will need to perform.

The following are some steps that you can use iteratively as you refine the architecture.

  1. Start by sketching an outline of the architecture, based on the principal requirements, including the domain model and use cases. At this stage, you can determine the main components that will be needed, such as databases, particular hardware devices and the main software subsystems.
  2. Refine the architecture by identifying the main ways in which the components will interact, and by identifying the interfaces among them. Also, decide how each piece of data and functionality will be distributed among the various components.

Deployment diagrams

A deployment diagram describes the hardware where various instances of components reside at run time. An example is shown in Figure. A node in a deployment diagram represents a computational unit such as a computer, a processing card, a sensor or a device. It appears as a three-dimensional box. The links between nodes show how communication takes place. Each node of a deployment diagram can include one or several run-time software components. Various artifacts such as files can also be shown inside nodes.

Architectural patterns

The notion of patterns can be applied to software architecture. In this chapter we present several of the most important architectural patterns , which are also often called architectural styles. Each allows you to design flexible systems using components that are as independent of each other as possible.

The Multi-Layer architectural pattern

Building software in layers is a classical architectural pattern that is used in many systems. It is so important that layer cohesion was one of the types of cohesion we presented earlier when discussing Design Principle 2. As we discussed, in layered systems each layer communicates only with the layers below it – in many cases, only the layer immediately below it. Each layer has a well-defined API, defining the services it provides. A complex system can be built by superimposing layers at increasing levels of abstraction. The Multi-Layer architectural pattern makes it possible to replace a layer by an improved version, or one with a different set of capabilities. It is particularly important to have a separate layer at the very top to handle the user interface. Independence of the UI layer allows the application to have several different UIs. These could be UIs running on different platforms, UIs for ‘professional’ versus ‘standard’ versions of the application, or UIs designed

for different locales (discussed in Chapter 7). We will look at the UI layer in more detail below when we discuss the Model–View–Controller architectural pattern. Layers immediately below the UI layer provide the application functions determined by the use cases. Layers at the bottom provide services such as data storage and transmission. This is illustrated in Figure.

Most operating systems are built according to the Multi-Layer architectural pattern, as shown in Figure. A low-level kernel layer deals with such functions as process creation, swapping, and scheduling. Higherlevel layers deal with such functions as user account management, screen display, etc. The layers are often further subdivided into smaller subsystems.

Most communications systems exhibit a layered architecture. A simplified illustration of this is shown in Figure. At the bottom level, there are facilities for transmitting and receiving signals. Above this is a layer that deals with splitting messages into packets and reconstructing messages that are received. Still higher is a layer that deals with handling ongoing connections with a remote host (e.g. using sockets). At the top is a layer that handles various protocols, such as http, used by application programs.

The Multi-Layer architectural pattern helps you adhere to many of the design principles discussed earlier, in particular:

  1. Divide and conquer : The layers can be independently designed.
  2. Increase cohesion : Well-designed layers have layer cohesion.
  3. Reduce coupling : Well-designed lower layers do not know about the higher layers and the only connection between layers is through the API.
  4. Increase abstraction : you do not need to know the details of how the lower layers are implemented.
  5. Increase reusability : The lower layers can often be designed generically.

look up the addresses of clients

Distributed architectures help you adhere to design principles such as the following:

  1. Divide and conquer : Dividing the system into client and server processes is a strong way to divide the system. each can be separately developed.
  2. Increase cohesion : The server can provide a cohesive service to clients.
  3. Reduce coupling : There is usually only one communication channel exchanging simple messages.
  4. Increase abstraction : Separate distributed components are often good abstractions.
  5. Increase reuse : It is often possible to find suitable frameworks on which to build good distributed systems. however, client-server systems are often very application specific.
  6. Design for flexibility : Distributed systems can often be easily reconfigured by adding extra servers or clients.
  7. Design for portability : You can write clients for new platforms without having to port the server. 10 Design for testability : You can test clients and servers independently.
  8. Design defensively : You can put rigorous checks in the message handling code.

The Broker architectural pattern

The idea of the Broker architectural pattern is to distribute aspects of the software system transparently to different nodes. This is illustrated in Figure.

Using the Broker architecture, an object can call methods of another object without knowing that this object is remotely located. The use of the Proxy design pattern can help achieve this goal. A Proxy object calls the broker, which determines where the remote object can be found. CORBA is a well-known open standard that allows you to build this kind of architecture – it stands for Common Object Request Broker Architecture. Java has many classes that allow you to use CORBA facilities. There are also several other commercial architectures that also provide broker capabilities.

The Broker architectural pattern

The Broker pattern is particularly useful in helping you follow these design principles:

  1. Divide and conquer : The remote objects can be independently designed.
  2. Increase reusability : It is often possible to design the remote objects so that other systems can use them too.
  1. Increase reuse : You may be able to reuse remote objects that others have created.
  2. Design for flexibility : The brokers can be updated as required, or the proxy can communicate with a different remote object.
  3. Design for portability : You can write clients for new platforms while still accessing brokers and remote objects on other platforms.
  4. Design defensively : You can provide careful assertion checking in the remote objects.

The Pipe-and-Filter architectural pattern

The Pipe-and-Filter architectural pattern is also often called the transformational architectural pattern. It works as follows. A stream of data, in a relatively simple format, is passed through a series of processes, each of which transforms it in some way. The series of processes is called a pipeline. Data is constantly fed into the pipeline; the processes work concurrently (conceptually at least) so that data is also constantly emerging from the pipeline. The strength of this pattern is that the system can be modified easily by adding or changing the transformational processes. This is easiest if, at most stages of the pipeline, the data has the same general form.

A pipe-and-filter architecture for sound processing

The Pipe-and-Filter architectural pattern allows us to adhere to the following design principles:

  1. Divide and conquer : The separate processes can be independently designed.
  2. Increase cohesion : The processes have functional cohesion.
  3. Reduce coupling : The processes have only one input and one output.
  4. Increase abstraction : The pipeline components are often good abstractions, hiding their internal details.
  5. Increase reusability : The processes can often be used in many different contexts.
  6. Increase reuse : It is often possible to find reusable components to insert into a pipeline.
  7. Design for flexibility : There are several ways in which the system is flexible.