Software Architecture Essentials: Design Principles & Patterns
Software Architecture Fundamentals
Definition (IEEE): The fundamental organization of a software system, including components, their relationships, and design principles.
Purpose: To ensure reliability, efficiency, security, and maintainability.
Architectural Design Process
Goal: Design the system’s overall structure and its communication.
Outputs: An architectural model showing component interaction.
Key Link: Connects requirements to design.
Software Architecture Documentation
Includes:
Product Overview
Static and Dynamic Architectural Models
Mapping Between Models
Design Rationale
Architectural Abstraction Levels
In the Small: Structure of a single program.
In the Large: Structure of enterprise-level systems across networks.
Benefits of Explicit Architecture
Stakeholder Communication
System Analysis (e.g., Performance, Security)
Supports Product-Line Reuse
Architectural Modeling Notations
Box-and-Line Diagrams: Abstract, great for communication.
UML Diagrams:
Component Diagrams
Package Diagrams
Deployment Diagrams
Component-Based UML Diagrams
Elements: Components, Interfaces, Ports, Relationships, Artifacts, Nodes.
Steps:
Identify System Scope
Define Components and Interfaces
Map Relationships and Dependencies
Draw the Diagram
Key Architectural Design Decisions
Vary by system but typically include:
Non-functional Properties (Performance, Maintainability, etc.)
Technology Stacks
Security and Reuse Decisions
Software Architecture Reuse
Used in: Same Domain, Similar Architectures
Method: Application Product Lines with Core Architecture and Variants
Impact of Software Architecture
Affects Non-functional Properties:
Performance: Localize Critical Operations
Security: Layered Architecture
Safety: Isolate Critical Features
Maintainability: Fine-Grain, Replaceable Parts
Availability: Redundancy
Architectural Design Trade-offs
Trade-Off | One Side | Other Side |
---|---|---|
Maintainability vs. Performance | Modular, Replaceable Components | Fewer Components, Better Speed |
Security vs. Usability | More Layers, Less Risk | More Layers, Worse User Experience (UX) |
Availability vs. Time to Market | More Redundancy, Higher Uptime | Increases Development Time and Cost |
Architectural Views: 4+1 Model
Logical View: Object Design
Development View: Module Structure
Process View: Dynamic Behavior, Concurrency
Physical View: Deployment
Scenarios (Use Cases): Validate All Other Views
Common Architectural Patterns
A pattern is a reusable solution to a recurring design problem.
MVC: Model-View-Controller Pattern
Model: Handles Business and Data Logic
View: Presentation and User Interface (UI)
Controller: Handles Input and Updates View or Model
Use Case: Applications with Multiple User Interfaces (UIs)
Advantage: Independent Changes in Model or User Interface (UI)
Layered Architecture Pattern
Divides a system into layers by functionality.
Rule: Layers Communicate Only with Directly Adjacent Layers.
Example: Web Application (User Interface, Business Logic, Database Access)
Pros: Modularity, Security, Easy Testing.
Cons: Difficult to Separate Layers Cleanly, Slower Performance.
Client-Server Architecture Pattern
Client: Requests Services
Server: Delivers Services (e.g., Printing, Database, etc.)
Advantages: Centralized Services, Scalable
Disadvantages: Single Point of Failure, Network Latency
Multi-Tier (N-Tier) Architecture Pattern
Web Tier (User Interface) → Application Tier (Business Logic) → Data Tier (Data Storage)
Promotes Separation of Concerns and Scalability
Addressing Cross-Cutting Concerns
Affect All Parts of a System (e.g., Logging, Security, Performance)
Difficult to Isolate; Must Plan Early in Architecture Design
Types of Application Architectures
Type | Description | Example |
---|---|---|
Data Processing | Batch Processing, No User Interaction | Payroll System |
Transaction Processing | Respond to User Input, Update Database | ATM, E-commerce |
Event Processing | React to External Events | Alarm System |
Language Processing | Parse User Commands or Formal Language | Compilers, Interpreters |
Real-World Architecture Examples
ATM System: Transaction-Based, Client-Server
Web E-commerce: Multi-Tier, MVC
Mentcare: Information System with Multiple Layers
Canvas (Example): Requires Unit Tests, Component Tests, System Tests, and Inspections
Technology Stack Selection
Database: SQL (e.g., MySQL) vs. NoSQL (e.g., MongoDB)
Delivery Platform: Mobile (Performance and Power Limits), Web
Server: In-House vs. Cloud (e.g., AWS, Azure)
Development Tools: Choose Tools Familiar to the Team