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.
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]
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 answerHide 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
| View | Focus | Stakeholder | Notation |
|---|---|---|---|
| Logical | Functionality | End users | Class, State diagrams |
| Process | Concurrency/Runtime | Integrators | Activity, Sequence diagrams |
| Development | Software organization | Programmers | Component, Package diagrams |
| Physical | Hardware mapping | System engineers | Deployment diagrams |
| Scenarios | Use cases | All | Use 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.
Model-driven architecture and transformations
2082 · 5 marks
What do you understand by the model driven architecture? Explain. [5]
2081 · 5 marks
Describe Model-driven architecture. What type of abstract system models are produced by it? [5]
2080 · 5 marks
Explain the need of Model-driven architecture transformations and how is it carried out? [5]
Architecture patterns and their importance
2081 · 10 marks
Why architecture patterns are important? Explain Model-View-Controller, layered and repository architecture.[10]
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 answerHide 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
| Component | Description |
|---|---|
| Filter | An independent processing unit that transforms or computes on input data to produce output data |
| Pipe | A connector (channel) that carries data from the output of one filter to the input of the next |
| Data Source | The origin of the input data stream (e.g., a file, keyboard, sensor) |
| Data Sink | The 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]
| Step | Filter | Role |
|---|---|---|
| 1 | who | Data source: lists all currently logged-in users |
| 2 | grep "^a" | Filter: keeps only lines starting with "a" |
| 3 | sort | Filter: sorts the lines alphabetically |
| 4 | uniq | Filter: removes duplicate lines |
| 5 | wc -l | Data 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
-
Simplicity and Clarity
- The system is easy to understand because each filter has a single, well-defined responsibility.
-
Reusability
- Filters can be reused in different pipelines without modification (e.g.,
sortandgrepin Unix are reused in many pipelines).
- Filters can be reused in different pipelines without modification (e.g.,
-
Modifiability and Maintainability
- Filters can be added, removed, or replaced without affecting other filters, as long as the data format is compatible.
-
Concurrency
- Multiple filters can execute in parallel (each on a different stage of the data), improving throughput.
-
Ease of Testing
- Each filter can be tested independently with known input and expected output.
-
Flexibility
- Different pipelines can be constructed by combining existing filters in new ways.
-
Scalability
- Individual filters can be scaled independently based on processing load.
Disadvantages of Pipe and Filter Architecture
-
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).
-
Data Transformation Overhead
- If filters use different data formats, extra parsing and conversion between filters can reduce performance.
-
Difficult Error Handling
- Propagating and handling errors across multiple filters is complex; a failure in one filter can corrupt the entire pipeline.
-
Latency
- The entire pipeline must process data sequentially (unless parallelized), which can introduce latency for large datasets.
-
Shared State is Difficult
- Filters are stateless and independent, so sharing state or context across filters is not straightforward.
-
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
| Aspect | Detail |
|---|---|
| Style | Data-flow architectural style |
| Main Components | Filters (processing) and Pipes (connectors) |
| Data Flow | Unidirectional, sequential |
| Best Used For | Compilers, data processing, Unix tools, ETL systems |
| Key Benefit | Modularity and reusability |
| Key Limitation | Not 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.
Layered architecture
0 · 10 marks
Briefly explain layered architecture, repository architecture, pipe and filter architecture.[10]
Make Unit 4 stick
Practice BIT302 with flashcards & quizzes