Module 4: Software Architecture, Design, and Patterns – Detailed Notes
1. Software Architecture
Definition:
Software architecture defines the high-level structure of a software system, the discipline of
creating such structures, and the documentation of these structures. It involves decisions about
software components, their interactions, and guiding principles for design and evolution.
Key Goals:
Ensure scalability (system can handle growth)
Improve maintainability (ease of updates and bug fixes)
Promote reliability (consistent performance over time)
Facilitate interoperability (systems working together)
1.1 Monolithic Architecture
Description: Entire application built as a single, unified unit.
Advantages:
o Simpler deployment (single codebase)
o Easier initial development for small teams
Disadvantages:
o Harder to scale specific components
o Changes in one part may require redeploying the entire system
o Can become fragile as codebase grows
Example: Traditional web applications where UI, business logic, and data access layers are
tightly integrated.
1.2 Microservices Architecture
Description: Application split into independent services, each responsible for a specific
business capability.
Advantages:
o Independent scaling of components
o Easier to adopt different tech stacks per service
o Fault isolation—failure in one service less likely to crash the whole system
Disadvantages:
o Increased complexity in communication (often via APIs)
o Higher operational overhead (deployment, monitoring)
Example: E-commerce platform with separate services for products, payments, and orders.
Sources:
Bass, L., Clements, P., & Kazman, R. (2012). Software Architecture in Practice. Addison-
Wesley.
2. Fundamental Design Principles
2.1 SOLID Principles
A set of five object-oriented design guidelines to improve software maintainability and
scalability.
1. S – Single Responsibility Principle (SRP)
o A class should have only one reason to change.
o Encourages modular design.
2. O – Open/Closed Principle (OCP)
o Software entities should be open for extension but closed for modification.
o Achieved via inheritance, interfaces, or polymorphism.
3. L – Liskov Substitution Principle (LSP)
o Subtypes must be substitutable for their base types without altering program
correctness.
4. I – Interface Segregation Principle (ISP)
o Clients should not be forced to depend on interfaces they do not use.
5. D – Dependency Inversion Principle (DIP)
o Depend on abstractions, not concrete implementations.
Sources:
Martin, R.C. (2003). Agile Software Development: Principles, Patterns, and Practices.
Prentice Hall.
3. Common Design Patterns
Definition:
Reusable solutions to common software design problems, described in a standardized format.
3.1 Model-View-Controller (MVC)
Model: Handles business logic and data.
View: Handles user interface representation.
Controller: Handles user input and updates the model/view.
Advantages:
Separation of concerns improves maintainability.
Easy to swap out UI without changing business logic.
Example: Web frameworks like Django (Python) and [Link] MVC (C#).
3.2 Singleton Pattern
Description: Ensures only one instance of a class exists and provides a global point of
access.
Use Cases:
o Configuration managers
o Logging systems
o Thread pools
Example (Python):
class Singleton:
_instance = None
def __new__(cls):
if cls._instance is None:
cls._instance = super().__new__(cls)
return cls._instance
Sources:
Gamma, E., Helm, R., Johnson, R., & Vlissides, J. (1994). Design Patterns: Elements of
Reusable Object-Oriented Software. Addison-Wesley.
4. API Design Principles
Definition:
Guidelines for creating interfaces that allow different software components to communicate
effectively.
Best Practices:
Consistency: Uniform naming and behavior.
Clarity: Clear documentation and meaningful naming.
Versioning: Use version control to manage changes without breaking clients.
Security: Authentication, authorization, and rate limiting.
RESTful or GraphQL: Choose based on data access needs.
Sources:
Masse, M. (2011). REST API Design Rulebook. O’Reilly Media.
5. Software Development Life Cycle (SDLC)
Definition:
A structured process for developing software systematically.
Common Models:
1. Waterfall: Sequential phases (requirements → design → implementation → testing →
deployment).
2. Agile: Iterative and incremental, focusing on flexibility and user feedback.
3. Spiral: Combines iterative development with risk analysis.
Importance for AI Systems:
AI systems often require iterative cycles for data collection, model training, and
deployment. Agile is often preferred for experimentation.
Sources:
Sommerville, I. (2015). Software Engineering. Pearson.
6. Ethical, Scalability, and Maintainability Considerations for AI Systems
Scalability: Microservices, cloud-native design, and distributed systems help AI systems
handle large-scale data processing.
Maintainability: Following SOLID and using design patterns reduces technical debt.
Ethics: Ensure transparency, fairness, and accountability in AI model design and
deployment.
✅ Key Takeaways:
Architectural choice (monolithic vs. microservices) impacts scalability and
maintainability.
SOLID principles guide clean, extendable design.
Design patterns like MVC and Singleton solve recurring structural problems.
Good API design is crucial for interoperability.
SDLC models structure the entire development process.