TOPIC 2
Software Design: Software Architecture (Part 1)
Learning Outcomes
Define software architecture
Differentiate architecture vs design
Explain why architecture is important
Identify common architectural patterns
Apply architecture concepts to a real system
What is Software Architecture?
Definition: Software architecture is the high-level structure of a system, which includes:
Components: The individual parts or modules of the system.
Relationships: How these components interact or relate to each other.
Interactions: The ways in which components communicate and collaborate.
Analogy: "Architecture is the blueprint of a system before we build it."
Importance of Architecture
Consequences of Lack of Architecture:
A system can become disorganized and messy.
Difficulty in scaling or maintaining the system effectively.
Key Elements of Architecture
Components
Definition: The building blocks of a system; analogous to rooms in a house or departments in an organization.
Example (Mobile Banking App):
Login module
Fund transfer module
Account history module
Notification module
Connectors
Definition: The means through which components communicate; can be likened to doors or hallways in a house.
Example (Mobile Banking App):
The login screen interacts with the authentication service.
The transfer module communicates with the database.
Notifications are sent via a messaging service.
Constraints
Definition: Rules that the system must follow, similar to building codes or laws for a company.
Example (Mobile Banking App):
Compliance with banking security regulations.
Password requirements (e.g., must be at least 8 characters).
All transactions must be logged.
Quality
Definition: The 'soft' goals defining the system's performance and efficiency, equated to comfort and safety in a house.
Example (Mobile Banking App):
Performance must be swift (e.g., login < 2 seconds).
Security measures: User data must be encrypted.
Scalability: The app must handle 100,000 users.
Reliability: The app should not crash during transfers.
Architecture vs Design
Architecture
Focus: High-level structure of the system.
Phase: Early in the development process.
Scope: Big picture view, understanding overall system flow.
Design
Focus: Low-level implementation details of the system.
Phase: Later in the development process.
Scope: Small details, such as database schema and user interface layout.
Why Software Architecture is Important?
Enhances system scalability.
Improves maintainability of the system over time.
Supports performance optimization strategies.
Enables team collaboration across different areas of development.
Reduces development risks by anticipating potential problems.
Quote: "Bad architecture = expensive problems later."
Architectural Patterns
Layered Architecture
Analogy: Similar to building a layered cake or a company organized by departments.
Structure:
Presentation Layer: User-facing part (e.g., cashier in a store).
Business Logic Layer: Processing rules and functionalities (e.g., manager processing sales).
Data Layer: Information storage and retrieval (e.g., warehouse for products).
Flow: User → UI → Logic → Database
Example (Mobile Banking App):
Presentation Layer: Mobile app screens (login, transfer, account summary).
Business Logic Layer: Processes requests (validates logins, checks balances).
Data Layer: Holds account and transaction records, user data.
Client-Server Architecture
Definition: A distributed system structure with a client requesting services and a server providing them.
Example (Mobile Banking App):
Client: Mobile banking app on user's phone, sending requests (e.g., "Show my balance.").
Server: Bank's backend server processing requests, accessing databases, sending responses.
Model-View-Controller (MVC)
Definition: An architectural pattern for separating data, user interface, and logic.
Model: Manages data and business rules.
View: Represents the UI elements.
Controller: Processes user input, updates the model and the view based on actions.
Example (Mobile Banking App):
Model: Contains account balances, transaction history, user profiles.
View: UI elements like login screens and account summaries.
Controller: Manages actions (e.g., "Transfer $100," "Update profile").
Architectural Patterns Comparison
Pattern | Best For | Strengths | Weaknesses | Example |
|---|---|---|---|---|
Layered | Structured Systems | Easy to maintain, separates concerns | Can incur overhead and be slower | Enterprise Payroll System |
Client-Server | Distributed systems | Centralized control, multiple clients | Server bottlenecks, network dependency | Online Multiplayer Game |
MVC | UI-heavy apps | Clear separation, easy UI updates | Slightly complex to implement | E-commerce Web Application |
Summary
Architecture: Represents the high-level blueprint of a system.
Focuses on components, layers, interactions, and architectural patterns.
Considered critical for the success of a system.
Architectural patterns provide structured approaches to building systems effectively.
Thank You
Here are 20 multiple-choice questions (MCQs) based on software architecture:
What is the primary focus of software architecture?
a) Coding standards
b) High-level structure of the system
c) User interface design
d) Individual components
Answer: b)What does a component in software architecture refer to?
a) The overall system
b) Interaction protocols
c) Individual parts or modules
d) User documentation
Answer: c)Why is architecture important in software development?
a) It makes coding easier
b) It enhances system scalability and maintainability
c) It eliminates bugs
d) It focuses solely on design
Answer: b)Which of the following is NOT a consequence of lack of architecture?
a) Disorganized system structure
b) Improved performance
c) Difficulties in scaling
d) Maintenance challenges
Answer: b)In a modular software architecture, components are compared to:
a) Rooms in a house
b) Employees in a company
c) Cars in a parking lot
d) Websites on the internet
Answer: a)What do connectors do in software architecture?
a) Store data
b) Manage user input
c) Facilitate communication between components
d) Define coding standards
Answer: c)Which layer of the layered architecture deals with data storage?
a) Presentation Layer
b) Data Layer
c) Business Logic Layer
d) Connectors
Answer: b)A client-server architecture is defined by:
a) All components being on the same server
b) A distributed system where clients request services and servers provide them
c) No communication between components
d) Single-user interaction only
Answer: b)In the MVC pattern, which component manages data and business rules?
a) Model
b) View
c) Controller
d) Connector
Answer: a)What defines quality in architecture?
a) Coding techniques
b) Performance and efficiency goals
c) Number of components
d) Design aesthetics
Answer: b)What phase does architectural design typically occur in?
a) After detailed design
b) Early in the development process
c) During the testing phase
d) After user feedback
Answer: b)How does software architecture impact team collaboration?
a) It reduces overall team size
b) It creates confusion among developers
c) It facilitates communication across different development areas
d) It is irrelevant to team dynamics
Answer: c)Which is a common quote related to software architecture?
a) “Good architecture leads to slow performance.”
b) “Bad architecture = expensive problems later.”
c) “Architecture is just fluff.”
d) “Design is key; architecture does not matter.”
Answer: b)What is an example of a constraint in a banking application?
a) User interface design principles
b) Compliance with security regulations
c) Marketing strategies
d) Coding languages used
Answer: b)Which architectural pattern separates the user interface, data, and business logic?
a) Layered architecture
b) Client-server architecture
c) Model-View-Controller (MVC)
d) Component-based architecture
Answer: c)What is the role of the presentation layer?
a) Data processing
b) User interaction
c) Server configuration
d) Database management
Answer: b)In a software architecture context, what do interactions refer to?
a) Connections between servers
b) User communication with the system
c) How components communicate and collaborate
d) Transactions processed by the database
Answer: c)What does the architecture vs design distinction emphasize?
a) Only coding styles
b) High-level vs low-level concerns
c) Marketing strategies
d) User interface improvements
Answer: b)Which of the following is a characteristic of layered architecture?
a) Components are tightly coupled
b) It allows separation of concerns
c) All layers must be changed simultaneously
d) There are no defined layers
Answer: b)Why should developers consider software architecture early in the process?
a) To avoid rework and reduce risks later in development
b) It has no impact on the final product
c) To create more components than necessary
d) To limit team collaboration
Answer: a)