Chapter 1: Fundamentals of Software Architecture and Design
1.1 Concepts and Importance of Software Architecture
Software Architecture is a high-level abstraction and description of the structure and organization of a software system. It serves as a blueprint for software development and evolution.
Why is Software Architecture Important?
- Large-scale Systems: Modern systems involve millions of lines of code, hundreds of developers, massive data manipulation, heterogeneous platforms, and distributed environments.
- Critical Requirements: Systems are often mission-critical, business-critical, or safety-critical where failures are unacceptable, timeliness is essential (real-time processing), and high availability (24/7) is required.
- Key System Aspects: Good architecture facilitates decentralization, portability, scalability, manageability, security, and sustained engineering/evolution.
1.2 Software Architecture vs. Software Design
While closely related, architecture and design represent different levels of abstraction. They are not mutually exclusive but work together through collaboration.
- Software Architecture: Represents the conceptual/logical abstraction, the skeleton/backbone of the system, and common attributes. It answers questions like "What happens if 1,000 users press a button at once?" and provides a way to predict system performance based on Principles.
- Software Design: Represents the plan/instruction, the blueprint of specific components, and detailed structural descriptions. It answers questions like "What happens if one user presses a button?" and assures system functions based on Solutions.
Types of Architectural Models:
- Logic (Functional) Architecture: Describes relationships among software components (e.g., UI, database, business unit).
- Physical (System) Architecture: Maps software units to hardware nodes (deployment in the execution environment).
- Technological Architecture: Describes SDKs, development technologies, and technological standards.
1.3 Architectural Thinking
An architect sees systems differently from a developer. Thinking like an architect involves four main aspects:
- Collaboration: Understanding the difference between architecture and design, and maintaining a tight, bidirectional relationship with development teams.
- Technical Breadth over Depth: Developers need deep technical expertise (depth) in specific tools to maintain code. Architects need a wide breadth of technical knowledge (knowing what exists) to match capabilities to technical constraints.
- Analyzing Trade-Offs: There are no "right or wrong" answers in architecture—only trade-offs. Solutions depend on the deployment environment, business drivers, company culture, budgets, timeframes, and developer skill sets.
- Business Drivers: Understanding how business needs translate into architectural concerns.
1.4 Modularity
Modularity refers to standardizing parts or independent units (like classes or packages) to construct a more complex structure. Modularity is measured using three key concepts:
-
1.4.1 Cohesion (Intra-module concept): Refers to how closely the elements within a single software module belong together. High cohesion is ideal.
- Functional (Best): Every part of the module is essential to its function.
- Sequential/Communicational/Procedural/Temporal: Other forms of cohesion based on execution order, data chains, or timing dependencies.
- Measurement: Can be measured using the LCOM (Lack of Cohesion in Methods) metric.
-
1.4.2 Coupling (Inter-module concept): The degree of interdependence or interaction between two or more modules. Low coupling is ideal.
- Data Coupling (Best): Modules share write access to the same global data.
- Stamp Coupling: Passing whole data structures when only parts are needed.
- Control / Common Coupling: Passing control elements or sharing common data structures.
- Content Coupling (Worst): One module directly references the internal contents of another.
-
1.4.3 Connascence: Two components are connascent if a change in one requires the other to be modified to maintain system correctness. It acts as a great refactoring guide (can be Static/compile-time or Dynamic/run-time).
1.5 Architecture Characteristics
Architecture characteristics specify non-domain design considerations that influence the structural aspect of the design and are critical to application success. They are categorized into three types:
- Operational: Characteristics related to system running states. Examples include Scalability (handling concurrent users), Elasticity (handling bursts of requests), Performance, Availability, Reliability, and Robustness.
- Structural: Characteristics related to the codebase and development. Examples include Maintainability, Extensibility, Portability, Configurability, and Upgradeability.
- Cross-Cutting: Global considerations such as Security, Privacy, Accessibility, Authentication, and Legal compliance.
Note: Architects uncover these characteristics by extracting them from domain concerns, specific requirements, and implicit domain knowledge.
1.6 Key Issues in Software Design
When designing software, architects must address several quality concerns:
- Concurrency: Decomposing software into processes/threads and handling efficiency, atomicity, and synchronization.
- Control and Handling of Events: Organizing data/control flow for reactive and temporal events.
- Data Persistence: Handling long-lived data.
- Distribution of Components: Distributing software across hardware and managing communication via middleware.
- Error/Exception Handling: Preventing, tolerating, and processing faults.
- Interaction and Presentation: Structuring user interactions (e.g., separating UI and business logic via MVC).
- Security: Preventing unauthorized access or data modification.
1.7 Evolution of Software Architecture
- Stage 1: No-Architecture (1946–1969): Machine code and assembly (FORTRAN, COBOL). Small, simple programs bonded directly to hardware with no architectural consideration.
- Stage 2: Infant Stage (1970–1980): Advanced programming languages appeared. Software Engineering was born; basic control flow and data flow designs emerged.
- Stage 3: Junior Stage (1980–1990): The rise of large-scale systems and Object-Oriented Programming (OOP). Unified Modeling Language (UML) was invented in 1994, bringing attention to architectural design.
- Stage 4: Advanced Stage (Since 1990): Systems became highly complex. Shifted from "Algorithms + Data Structures" to "Components + Architectural Assembly." Advanced abstractions like Kruchten’s “4+1” View Model were developed.