Lecture 2 - Visualising Software Architure With c4 Model
Lecture 2 - Visualising Software Architure With c4 Model
WITH C4 MODEL
WE HAVE A FAILURE TO COMMUNICATE
What happened to SSADM, RUP, UML, etc?
• Overview:
• Favorite diagram in presentation.
• Sole visual aid for solution presentation.
• Diagram's Strengths:
• Central spine illustrates data flow from source systems
(TDS and RDS).
• Simple activity diagram outlining steps: data import,
calculations, report generation, distribution.
• Concerns and Confusion:
• Breakdown on the right: Unclear significance of the
green circle; clock implies scheduled events.
• Left side complexity: Overlapping lines, varied colors,
and styles.
• Upside-down "UI" letters: Result of individuals writing
from different positions around the table.
• Recommendations:
• Address ambiguity in the green circle and clock
elements.
• Simplify and clarify the left side of the diagram for better
understanding.
• Key Takeaway:
• Despite initial clarity, the diagram suffers from
communication breakdown due to unclear elements,
impacting overall comprehension.
• Purpose:
•
Generically true
Ideal for quick and basic representation of software
architecture.
• Convenient for conveying an overview without delving into
specifics.
• Content Overview:
• Standard "Software Architecture 101" style.
• Generic labels like "transport," "archive," "audit," "report
generation," and "error handling."
• Central box labeled "business logic," lacking detailed
description.
• Strengths:
• Straightforward and easy to understand.
• Serves as a quick reference for software architecture
overview.
• Areas of Improvement:
• Lack of specificity in labels may lead to ambiguity.
• "Business logic" could benefit from more detailed
explanation or breakdown.
• Recommendations:
• Consider providing additional details in labeled boxes for
clearer understanding.
• Enhance the description of "business logic" for a more
informative representation.
• Key Message:
• While simplistic and suitable for a quick overview, further
detailing in specific areas would enhance clarity and
communication of the software architecture.
The “logical view”
• Type of Diagram:
• Logical, conceptual, or functional representation of software
system architecture.
• Content Overview:
• Illustrates the high-level building blocks of the software
system.
• Limited information beyond depicting the conceptual
structure.
• Purpose and Misconception:
• Intended to show logical relationships among components.
• Common misconception: Software architecture diagrams
should remain "logical" and avoid technology or
implementation details, especially pre-code development.
• Strengths:
• Provides a quick grasp of the conceptual structure of the
system.
• Limitations:
• Offers minimal information, lacks details about specific
functionalities or technologies.
• Future Considerations:
• Acknowledges the debate on whether to include technology
details in architectural diagrams.
• Key Takeaway:
• Useful for conveying the overall conceptual framework but
may require additional, detailed diagrams for a
comprehensive understanding of the software system's
architecture.
Deployment vs execution context
• Focus:
• Unix box, specifically "Risk Analysis System"
and "Data Import Service."
• Issue:
• Annotated as "JAR" (Java ARchive) but lacks
clarity on execution context.
• Ambiguity:
• Unix may not execute JAR files as standalone
applications without specific conditions.
• Recommendation:
• Clarify if "Risk Analysis System" and "Data
Import Service" operate as standalone
applications in the Unix environment.
• Key Message:
• Resolve ambiguity by specifying the execution
context for a more accurate depiction of
system behavior.
Homeless Old C# Object (HOCO)
• Components:
• C# console application and SQL Server
database identified.
• Uncertainty surrounds other C# components,
services, and modules.
• Ambiguity Source:
• Lack of clear boundaries or granularity
definition for various components.
• Proposal:
• Suggests enclosing most components within a
box to indicate their collective presence within
the C# console application.
• Objective:
• Provide clarity on whether components are at
the same level or part of the application.
• Key Message:
• Clarify boundaries by placing most
components within a designated box for a
clearer understanding of their role within the
C# console application.
Common problems
• 1. System Context:
– Overview of how the software system interacts with its external environment.
– Provides a high-level perspective of the system's place in the broader context.
• 2. Containers:
– Zooms into the software system, highlighting high-level technical building blocks (containers).
– Illustrates interactions between containers to understand the system's architecture.
• 3. Components:
– Focuses on an individual container, showcasing the internal components.
– Provides a detailed look at the structure within specific containers.
• 4. Code (UML Class) Diagram:
– Zooms into an individual component, revealing the implementation details.
– Visualizes the relationships and structure of code components within the system.
Hierarchical maps of your code
Intent Motivation
A System Context diagram helps you to answer the • Clearly defines system context and scope.
following questions.
1. What is the software system that we are building (or • Eliminates assumptions for a clear overview.
have built)? • Serves as a starting point, identifying stakeholders and
2. Who is using it? facilitating efficient requirements gathering.
3. How does it fit in with the existing environment?
• Illustrate organizational/enterprise
boundary with a dashed line.
• Show interactions between your system
and entities outside the boundary.
• Example: Dashed line represents the
bank's boundary.
• Capture contextual information about
location:
– Inside the boundary: Your software system
and internal entities.
– Outside the boundary: External software
systems and users.
– Emphasize interactions across the boundary.
LEVEL 2 : CONTAINER DIAGRAM
LEVEL 2: CONTAINER DIAGRAM
Intent Motivation
• Container diagram illustrates high-level software • Opens up software system, revealing internal
architecture. components.
• Highlights distribution of responsibilities and major • Advantages:
technology choices. • Explicit high-level technology choices.
• Addresses key questions for developers and • Illustrates container relationships and
support/operations staff: communication.
• Overall shape of the software system. • Avoids clutter, serving as an intermediate step before
• High-level technology decisions. detailed Component diagrams.
• Distribution of responsibilities.
• Communication channels between containers. Required or optional?
• Development focus areas for implementing All software systems should have a Container diagram.
features.
Audience
• Targets technical professionals, from developers to
support staff.
STRUCTURE
• Internet Banking System comprises five
containers: Web App, Single-Page App,
Mobile App, API, and Database.
– Web App: Java/Spring MVC serving static
content; includes Single-Page App.
– Single-Page App: Angular application in
customer's browser, offering all banking
features.
– Mobile App: Cross-platform Xamarin app for
subset of functions.
– JSON/HTTPS API connects Single-Page App
and Mobile App to server-side Java/Spring MVC
App.
– API App interacts with Database (relational
schema) and Mainframe Banking System
(XML/HTTPS).
• Uses existing E-mail System for
customer emails.
• Physical instances, failover, clustering
details covered in separate Deployment
diagram.
ELEMENTS - CONTAINERS
Intent
Audience
Component diagram addresses key questions:
• Technical people within the software development
1. Identifies components within each container. team.
2. Ensures all components have a designated container.
3. Provides clarity on high-level software workings.
Intent
Audience
Code-level diagrams aim to illustrate code structure,
• Technical people within the software development
showcasing component implementation details.
team, specifically software devel
1. The system should support the booking of different room types like standard, deluxe,
family suite, etc.
2. Guests should be able to search the room inventory and book any available room.
3. The system should be able to retrieve information, such as who booked a particular
room, or what rooms were booked by a specific customer.
4. The system should allow customers to cancel their booking - and provide them with
a full refund if the cancelation occurs before 24 hours of the check-in date.
5. The system should be able to send notifications whenever the booking is nearing the
check-in or check-out date.
6. The system should maintain a room housekeeping log to keep track of all
housekeeping tasks.
7. Any customer should be able to add room services and food items.
8. Customers can ask for different amenities.
9. The customers should be able to pay their bills through credit card, check or cash
Class Diagram
1. Any library member should be able to search books by their title, author, subject category as well
by the publication date.
2. Each book will have a unique identification number and other details including a rack number
which will help to physically locate the book.
3. There could be more than one copy of a book, and library members should be able to check-out
and reserve any copy. We will call each copy of a book, a book item.
4. The system should be able to retrieve information like who took a particular book or what are the
books checked-out by a specific library member.
5. There should be a maximum limit (5) on how many books a member can check-out.
6. There should be a maximum limit (10) on how many days a member can keep a book.
7. The system should be able to collect fines for books returned after the due date.
8. Members should be able to reserve books that are not currently available.
9. The system should be able to send notifications whenever the reserved books become available,
as well as when the book is not returned within the due date.
10.Each book and member card will have a unique barcode. The system will be able to read
barcodes from books and members’ library cards.
Class Diagram
• Library: The central part of the organization for which this software has
been designed. It has attributes like ‘Name’ to distinguish it from any
other libraries and ‘Address’ to describe its location.
• Book: The basic building block of the system. Every book will have
ISBN, Title, Subject, Publishers, etc.
• BookItem: Any book can have multiple copies, each copy will be
considered a book item in our system. Each book item will have a unique
barcode.
• Account: We will have two types of accounts in the system, one will be a
general member, and the other will be a librarian.
• LibraryCard: Each library user will be issued a library card, which will be
used to identify users while issuing or returning books.
• BookReservation: Responsible for managing reservations against book
items.
• BookLending: Manage the checking-out of book items.
• Catalog: Catalogs contain list of books sorted on certain criteria. Our
system will support searching through four catalogs: Title, Author,
Subject, and Publish-date.
• Fine: This class will be responsible for calculating and collecting fines
from library members.
• Author: This class will encapsulate a book author.
• Rack: Books will be placed on racks. Each rack will be identified by a
rack number and will have a location identifier to describe the physical
location of the rack in the library.
• Notification: This class will take care of sending notifications to library
members.
Case Study – Design an ATM
• The main components of the ATM that will • The user can have two types of accounts:
affect interactions between the ATM and its 1) Checking, and 2) Savings, and should
users are:
be able to perform the following five
1. Card reader: to read the users’ ATM cards.
transactions on the ATM:
2. Keypad: to enter information into the ATM
e.g. PIN. cards. 1. Balance inquiry: To see the amount of
3. Screen: to display messages to the users. funds in each account.
4. Cash dispenser: for dispensing cash. 2. Deposit cash: To deposit cash.
5. Deposit slot: For users to deposit cash or 3. Deposit check: To deposit checks.
checks.
6. Printer: for printing receipts. 4. Withdraw cash: To withdraw money from
7. Communication/Network Infrastructure: it their checking account.
is assumed that the ATM has a 5. Transfer funds: To transfer funds to
communication infrastructure to communicate another account.
with the bank upon any transaction or activity.
Class Diagram
ATM: The main part of the system for which this software has been designed.
It has attributes like ‘atmID’ to distinguish it from other available ATMs, and
‘location’ which defines the physical address of the ATM.
CardReader: To encapsulate the ATM’s card reader used for user
authentication.
CashDispenser: To encapsulate the ATM component which will dispense
cash.
Keypad: The user will use the ATM’s keypad to enter their PIN or amounts.
Screen: Users will be shown all messages on the screen and they will select
different transactions by touching the screen.
Printer: To print receipts.
DepositSlot: User can deposit checks or cash through the deposit slot.
Bank: To encapsulate the bank which ownns the ATM. The bank will hold all
the account information and the ATM will communicate with the bank to
perform customer transactions.
Account: We’ll have two types of accounts in the system: 1)Checking and
2)Saving.
Customer: This class will encapsulate the ATM’s customer. It will have the
customer’s basic information like name, email, etc.
Card: Encapsulating the ATM card that the customer will use to authenticate
themselves. Each customer can have one card.
Transaction: Encapsulating all transactions that the customer can perform
on the ATM, like BalanceInquiry, Deposit, Withdraw, etc.
MORE EXAMPLES
System Landscape diagram