4 Software Architecture

Software Engineering · Unit 4

Software Architecture

Exam-focused notes for Software Architecture (Software Engineering, BIT302): what the TU syllabus asks and how it has actually been tested, with 8 solved past questions from this unit.

Software Architecture in short

Software architecture is the high-level structure of a system. It shows the main parts and how they connect. Good architecture makes a system easier to build, change and scale.

Software Architecture: notes

Architectural views and design questions

Architecture is the link between requirements and detailed design. Early decisions here are hard to change later and affect performance, security and maintainability.

Why architecture matters:

  • It helps stakeholders discuss the system.
  • It affects performance, reliability and maintainability.
  • It allows reuse of large components.

One diagram cannot show everything, so we use several views. The "4+1" view model suggests:

  • Logical view: key abstractions as objects or classes.
  • Process view: how processes run and communicate at runtime.
  • Development view: how software is split for developers.
  • Physical view: hardware and how components are placed on it.
  • Scenarios (+1): use cases that tie the four views together.

Questions an architect must answer:

  • Is there a generic application architecture that can be used?
  • How will the system be spread across hardware?
  • Which patterns or styles can be used?
  • What approach will structure the system?
  • How will the parts be broken down into modules?
  • What control strategy is used?
  • How will the design be evaluated and documented?

Layered architecture

The layered architecture organizes a system into layers. Each layer gives services to the layer above and uses services of the layer below.

A common web example, from top to bottom:

  1. User interface layer.
  2. Application and business logic layer.
  3. Data access layer.
  4. Database and system support layer.

Advantages:

  • Each layer can be replaced if its interface stays the same.
  • Changes stay inside one layer.
  • Layers can be developed and tested separately.
  • It supports incremental development and security (the most critical data sits in the lowest layer).

Disadvantages:

  • A clean split is hard to achieve in practice.
  • A request that passes through many layers can slow performance.
  • A strict layer rule can force extra code that only passes data along.

What this unit covers

  • Architectural views and design questions
  • Layered architecture
  • Repository architecture
  • Pipe and filter architecture
  • Model-View-Controller pattern
  • Architecture patterns and their importance
  • Model-driven architecture and transformations

Architectural views and design questions

2082 · 5 marks

Explain different architectural views with a neat diagram. [5]

An architectural view is a representation of a software system from a specific perspective, addressing the concerns of particular stakeholders. The most widely accepted model for describing software architecture using multiple views is the "4+1 View Model" proposed by Philippe Kruchten (1995). --...

Open this answer on its own page →

2080 · 10 marks

Explain different architectural views. What are the fundamental questions that needs to be answered when designing a system architecture?[10]

Show solved answer

Architectural Views and Fundamental Questions in System Architecture Design


Part 1: Different Architectural Views

Software architecture cannot be fully described by a single diagram or perspective. Multiple architectural views are used to represent different aspects of a system, each addressing the concerns of different stakeholders.

The most widely accepted model is the "4+1" View Model proposed by Philippe Kruchten.


1. Logical View (Design View)

  • Describes the functional requirements of the system -- what the system should provide to end users.
  • Focuses on the object model of the design (classes, objects, relationships).
  • Stakeholders: End users and designers.
  • Represented using: Class diagrams, Object diagrams, State diagrams.

Example: How the system is decomposed into key abstractions and objects.


2. Process View

  • Describes the dynamic aspects of the system -- how processes communicate and run concurrently.
  • Addresses concerns of concurrency, distribution, performance, and scalability.
  • Stakeholders: System integrators and performance engineers.
  • Represented using: Activity diagrams, Sequence diagrams.

Example: How threads interact and how tasks are scheduled at runtime.


3. Development View (Implementation View)

  • Describes the system from a programmer's perspective.
  • Focuses on the organization of software modules in the development environment (packages, components, subsystems).
  • Addresses concerns of software management, reuse, and portability.
  • Stakeholders: Programmers and software managers.
  • Represented using: Component diagrams, Package diagrams.

Example: How source code is organized into modules and libraries.


4. Physical View (Deployment View)

  • Describes the mapping of software onto hardware.
  • Addresses concerns of topology, distribution, delivery, and installation.
  • Stakeholders: System engineers and network administrators.
  • Represented using: Deployment diagrams.

Example: Which server hosts which component, and how nodes are connected.


5. Scenarios View (Use Case View) -- The "+1"

  • Describes the system from the end user's perspective using use cases.
  • Acts as the central view that ties all other views together.
  • Used to validate and illustrate the architecture.
  • Stakeholders: All stakeholders.
  • Represented using: Use case diagrams, Interaction diagrams.

Example: A user logs in -- this scenario involves logical, process, development, and physical views simultaneously.


Summary Table

ViewFocusStakeholderNotation
LogicalFunctionalityEnd usersClass, State diagrams
ProcessConcurrency/RuntimeIntegratorsActivity, Sequence diagrams
DevelopmentSoftware organizationProgrammersComponent, Package diagrams
PhysicalHardware mappingSystem engineersDeployment diagrams
ScenariosUse casesAllUse case diagrams

Part 2: Fundamental Questions in Designing a System Architecture

When designing a system architecture, an architect must answer the following fundamental questions:


1. What are the system's functional requirements?

  • What must the system do?
  • What are the core features and services the system must provide to users?

2. What are the non-functional requirements (Quality Attributes)?

  • What are the performance, scalability, reliability, security, and maintainability requirements?
  • These often drive major architectural decisions.

3. How should the system be decomposed?

  • How should the system be broken down into components, modules, or subsystems?
  • What are the responsibilities of each component?

4. How will components communicate and interact?

  • What interfaces and protocols will components use?
  • Will communication be synchronous or asynchronous?
  • How will data flow between components?

5. How will the system be distributed?

  • Will the system run on a single machine or multiple nodes?
  • How will it handle distributed computing, load balancing, and fault tolerance?

6. What architectural style or pattern should be used?

  • Should the system follow layered, microservices, event-driven, client-server, or pipe-and-filter architecture?
  • Which pattern best fits the requirements?

7. How will the system handle change and evolution?

  • How flexible and extensible is the architecture?
  • Can new features be added without major restructuring?

8. What are the technology and platform constraints?

  • What programming languages, frameworks, databases, and hardware will be used?
  • Are there legacy system constraints?

9. How will the system ensure security?

  • How will authentication, authorization, and data protection be handled?
  • Where are the security boundaries?

10. How will the system be tested, deployed, and maintained?

  • What is the deployment strategy?
  • How will the system be monitored and updated after deployment?

Conclusion

Architectural views provide multiple perspectives on a system to satisfy the concerns of different stakeholders. The 4+1 model (Logical, Process, Development, Physical, and Scenarios) is the standard approach. Answering the fundamental architectural questions ensures that the system is well-structured, meets both functional and non-functional requirements, and can evolve over time.

Open this answer on its own page →

Model-driven architecture and transformations

2082 · 5 marks

What do you understand by the model driven architecture? Explain. [5]

Model Driven Architecture (MDA) is a software development approach proposed by the Object Management Group (OMG) that focuses on creating and exploiting domain models (abstract representations of the problem domain) rather than focusing on the computing or implementation technology. It separates ...

Open this answer on its own page →

2081 · 5 marks

Describe Model-driven architecture. What type of abstract system models are produced by it? [5]

Model-Driven Architecture (MDA) is a software design and development approach proposed by the Object Management Group (OMG) that focuses on creating models of a system at different levels of abstraction, and then transforming those models automatically (or semi-automatically) into executable code...

Open this answer on its own page →

2080 · 5 marks

Explain the need of Model-driven architecture transformations and how is it carried out? [5]

Note: No specific curriculum notes were found for this topic. The following answer is based on standard Software Engineering knowledge as taught in BSc CSIT programs. --- Model-Driven Architecture (MDA) is an approach to software development proposed by the Object Management Group (OMG) that sepa...

Open this answer on its own page →

Architecture patterns and their importance

2081 · 10 marks

Why architecture patterns are important? Explain Model-View-Controller, layered and repository architecture.[10]

Architecture patterns are important for the following reasons: 1. Reusability: They provide proven, reusable solutions to commonly occurring design problems, saving time and effort. 2. Common Vocabulary: They establish a shared language among developers and stakeholders, making communication clea...

Open this answer on its own page →

Pipe and filter architecture

2079 · 10 marks

What is pipe and filter architecture? Explain with an example. What are its advantages and disadvantages?[10]

Show solved answer

Pipe and Filter Architecture

Definition

Pipe and Filter is a software architectural style in which a system is decomposed into a series of processing components (filters) connected by channels (pipes). Each filter reads data from its input, processes or transforms it, and writes the result to its output. The filters are independent of one another and communicate only through the pipes.

Note: No specific curriculum notes were found for this topic. The answer below is based on standard, correct software engineering knowledge as taught in BSc CSIT.


Key Components

ComponentDescription
FilterAn independent processing unit that transforms or computes on input data to produce output data
PipeA connector (channel) that carries data from the output of one filter to the input of the next
Data SourceThe origin of the input data stream (e.g., a file, keyboard, sensor)
Data SinkThe final destination of the processed data (e.g., a file, display, database)

How It Works

[Data Source] --> |Pipe| --> [Filter 1] --> |Pipe| --> [Filter 2] --> |Pipe| --> [Data Sink]
  • Data flows unidirectionally through the pipeline.
  • Each filter is self-contained and knows nothing about the other filters.
  • Filters can run sequentially or even concurrently (in parallel pipelines).
  • The output of one filter is the input to the next.

Example: Unix Command Pipeline

A classic and well-known example is the Unix shell pipeline for text processing.

Scenario

Count the number of unique logged-in users whose names start with the letter "a".

Command

who | grep "^a" | sort | uniq | wc -l

Pipeline Breakdown

[who] --> |pipe| --> [grep "^a"] --> |pipe| --> [sort] --> |pipe| --> [uniq] --> |pipe| --> [wc -l]
StepFilterRole
1whoData source: lists all currently logged-in users
2grep "^a"Filter: keeps only lines starting with "a"
3sortFilter: sorts the lines alphabetically
4uniqFilter: removes duplicate lines
5wc -lData sink: counts and outputs the number of lines

Each component does one specific job and passes its result to the next via a pipe.


Another Example: Compiler Design

A compiler is often structured as a pipe and filter system:

[Source Code]
      |
      v
[Lexical Analyzer]  --> tokens
      |
      v
[Syntax Analyzer]   --> parse tree
      |
      v
[Semantic Analyzer] --> annotated tree
      |
      v
[Code Generator]    --> machine code
      |
      v
[Output File]

Each phase (filter) processes the output of the previous phase independently.


Advantages of Pipe and Filter Architecture

  1. Simplicity and Clarity

    • The system is easy to understand because each filter has a single, well-defined responsibility.
  2. Reusability

    • Filters can be reused in different pipelines without modification (e.g., sort and grep in Unix are reused in many pipelines).
  3. Modifiability and Maintainability

    • Filters can be added, removed, or replaced without affecting other filters, as long as the data format is compatible.
  4. Concurrency

    • Multiple filters can execute in parallel (each on a different stage of the data), improving throughput.
  5. Ease of Testing

    • Each filter can be tested independently with known input and expected output.
  6. Flexibility

    • Different pipelines can be constructed by combining existing filters in new ways.
  7. Scalability

    • Individual filters can be scaled independently based on processing load.

Disadvantages of Pipe and Filter Architecture

  1. Not Suitable for Interactive Systems

    • Because data flows in a fixed sequence, it is difficult to support interactive or event-driven applications (e.g., GUI applications).
  2. Data Transformation Overhead

    • If filters use different data formats, extra parsing and conversion between filters can reduce performance.
  3. Difficult Error Handling

    • Propagating and handling errors across multiple filters is complex; a failure in one filter can corrupt the entire pipeline.
  4. Latency

    • The entire pipeline must process data sequentially (unless parallelized), which can introduce latency for large datasets.
  5. Shared State is Difficult

    • Filters are stateless and independent, so sharing state or context across filters is not straightforward.
  6. Not Suitable for All Problems

    • Problems that require complex data sharing, backtracking, or non-linear data flow are difficult to model with this architecture.

Summary Table

AspectDetail
StyleData-flow architectural style
Main ComponentsFilters (processing) and Pipes (connectors)
Data FlowUnidirectional, sequential
Best Used ForCompilers, data processing, Unix tools, ETL systems
Key BenefitModularity and reusability
Key LimitationNot suitable for interactive or stateful systems

Pipe and Filter is one of the most fundamental and widely used architectural patterns in software engineering, especially in data processing, compiler design, and operating system utilities.

Open this answer on its own page →

Layered architecture

0 · 10 marks

Briefly explain layered architecture, repository architecture, pipe and filter architecture.[10]

--- Definition: Layered architecture organizes a system into a set of layers, where each layer provides services to the layer above it and acts as a client to the layer below it. Each layer has a well-defined role and communicates only with adjacent layers. Structure: Key Characteristics: - Each ...

Open this answer on its own page →