Feedback.md fileSoftware architecture defines the fundamental high-level structure of a software system.
It defines how system components are structured, how they interact and the guiding characteristics that shape its evolution.
We will be on to a new topic and learning software architecture for the rest of the course!
So, how is software architecture different to the software design that we have been learning so far in this course?
So far, we have dealt with software design at a code-level, think about how individual parts of a system are implemented (i.e. classes, methods, controllers and design patterns)
Architecture operates at more macro-level, system-wide and involve more structural decisions of a system that take more effort to change. Typically involve multiple components or subsystems.
Services communicate via RESTful APIs
Observer pattern to update UI when data changes
vs.
Architectural
Design
Specifically, it focuses on:
How the system is divided into modules, services, and layers for the frontend, backend, database, etc.
Layered
Microservices
We will learn more about this next week!
Specifically, it focuses on:
How data flows between different components
Specifically, it focuses on:
What technologies, frameworks or infrastructure are used
Examples include:
Specifically, it focuses on:
Architectural characteristics that should be addressed (e.g. security, scalability, performance, etc.)
We will learn more about this next week!
Software Architecture is like designing a blueprint for a garden.
Architectural style → Overall layout of a garden
Architectural components → Grouping of like plants
Class files in components → Individual plants within a group
Gardens are influenced by weather in the same way a software architecture is influenced by changes in
technology, deployment, etc.
Why is it so important to learn software architecture?
Helps teams visualise and communicate the software architecture of a system at different levels of abstraction.
The C4 Model includes 4 core diagrams:
These diagrams are a way to create "maps of your code" at different levels of detail, like zooming in and out on Google Maps
Shows the system as a "box" and its interactions with users and external systems (i.e. provides context surrounding the system)
We can see the external users and systems represented as the different countries
Who is the intended audience for the Context Diagram in the C4 model?
It communicates the scope and external dependencies of the system in a simple and accessible way.
Breaks the system into containers (applications/services/databases) and shows how they interact.
Why separate the web frontend and backend service into different containers?
Zooms into a specific container to show its internal components/controllers and their relationships.
How does a Container Diagram differ from a Component Diagram?
Container
Component
Offers a detailed view of the source code structure (e.g., classes and interfaces) within a component.
Our UML diagrams :)
- Course Management System
- Users (Students, Instructors)
- Auth System, Email System (external systems)
Context Diagram
Currently, all functionality of the Course Management System is implemented within a single monolithic backend. What might be the benefits of splitting this monolith into smaller, independent services?
How could we divide the system’s functionality to achieve better modularity, cohesion, and scalability?
A sequence diagram is an interaction diagram showing the temporal order of interactions between objects or components to achieve a specific functionality or use case
When would you choose to use a Sequence Diagram instead of a UML Class Diagram?
Actor: External user or system
Objects: Entities of the system
Lifelines: shows object existence during interactions
Messages: Communication between objects
Activation boxes: indicates active processing of messages
Activation box exists so the message is processed immediately
No activation box so message processing and response is delayed
Sender waits for the receiver to complete the operation and return a response before continuing its own execution
Sender does not wait for the receiver to complete the operation; it sends the message and continues its own execution
Solid line with open arrowhead are used for async messages
alt represents alternate scenarios
loop represents repeated actions
We can create our sequence diagram using Mermaid code on VSCode and preview it
Sequence diagrams are often criticised for becoming unreadable in complex systems. What are some techniques to manage this complexity?