LearningTree

Documentation & Communication

Goals of documentation, arc42, UML, views, interfaces & design decisions.

01
Chapter One

Goals, Benefits, and Quality Requirements of Documentation

"We don't need documentation. The truth is in the code"
At the beginningโ€ฆ

At the beginning everything is clear:

๐Ÿ“ System structure โš–๏ธ Design Decisions
โ†’ Initial false sense of speed

This has a heavy price in the long run

The problem with "code as documentation"

Source code is a low-level abstraction โ€” it does not contain:

  • โœ— Overall large-scale structure
  • โœ— Architectural decisions
  • โœ— Rationale for those decisions
  • โœ— Technology choices
  • โœ— Description of cross-cutting concerns
  • โœ— Cannot be read by all stakeholders (project managers / product managers, designers, analysts, etc.)
Why Document Software Architecture?

Architecture documentation bridges the gap between the decisions made during design and the people who need to understand, implement, test, operate, or evolve the system. Without documentation, knowledge lives only in the architect's head โ€” and people leave teams.

๐Ÿงญ

Create a Shared Understanding

All stakeholders โ€” developers, testers, operators, managers โ€” need a consistent mental model of the system.

๐Ÿ’ฌ

Enable Communication

Architecture docs are the primary medium for discussing, critiquing, and evolving design decisions across teams.

๐Ÿ”

Support Evolution

A documented architecture lets future architects understand past decisions and constraints before making changes.

โš–๏ธ

Record Decisions & Trade-offs

Document not just what was decided, but why โ€” including the alternatives that were rejected.

โœ…

Enable Evaluation

Documentation provides the basis for architectural reviews, audits, and quality assessments.

๐Ÿ“‹

Manage Onboarding

New team members can ramp up quickly when the architecture is clearly documented.

Benefits of Good Documentation

Over the lifetime of a system, documentation helps to:

๐Ÿ—บ๏ธ
Maintain
A clear overview of the system at all times.
๐Ÿ”
Locate & Fix
Errors and problems quickly, reducing downtime.
โš™๏ธ
Fulfill
Changing requirements with reasonable effort.
๐Ÿ”„
Keep Up
With technological changes over time.
Cost Impact

Documentation Quality vs Maintenance Cost

In large IT systems, costs correlate directly with documentation quality.

Poor Documentation High maintenance cost $$$
$$$
Good Documentation Lower maintenance cost $
$
Verbal & Written Communication

Architecture communication happens in two complementary modes โ€” each serves a different purpose in the design and decision-making cycle.

Written vs Verbal Communication โ€” The Architecture Cycle
Written Communication Documents & models Summarized & curated Long-term usage Slower, uni-directional Verbal Communication Explain, present, discuss Quick feedback Decision making Mutual understanding consider stakeholders & requirements clarify communicate evaluate design
๐Ÿ“ Written Communication
  • โ†’ Architecture documents, diagrams, and models
  • โ†’ Summarized, curated, and version-controlled
  • โ†’ Designed for long-term reference and reuse
  • โ†’ Reaches stakeholders asynchronously
  • โ†’ Slower to produce โ€” but persistent and precise
๐Ÿ—ฃ๏ธ Verbal Communication
  • โ†’ Explain, present, and discuss architecture
  • โ†’ Gather quick feedback from stakeholders
  • โ†’ Drive decisions in real time
  • โ†’ Build mutual understanding across teams
  • โ†’ Fast, bi-directional, and context-rich
Benefits for Different Stakeholders
๐Ÿ’ป
Developers
๐Ÿงช
Testers / QA
๐Ÿ–ฅ๏ธ
IT Operations
๐Ÿ“…
Project Managers
๐Ÿ‘ค
Customers
๐Ÿ›๏ธ
Other Architects
๐Ÿ’ป

Developers

  • Understand constraints and design guidelines
  • Know which components to use and how
  • Understand interface contracts
  • Avoid accidentally breaking cross-cutting concerns
๐Ÿงช

Testers / QA

  • Understand system boundaries and integration points
  • Know which quality requirements to verify
  • Derive test strategies from architecture views
๐Ÿ–ฅ๏ธ

IT Operations

  • Understand deployment and infrastructure needs
  • Know monitoring, logging, and failover requirements
  • Operate the system according to architectural intent
๐Ÿ“…

Project Managers

  • Understand scope and component dependencies
  • Plan work packages based on building blocks
  • Assess impact of changes on schedule and budget
Quality Requirements for Documentation

Good documentation must itself satisfy quality requirements. A document that is outdated, incorrect, or incomprehensible fails its purpose entirely, regardless of how much effort went into it.

๐Ÿ‘๏ธ Understandability

Judged only by readers. Tailor form, content, and level of detail to the stakeholder audience.

๐ŸŽฏ Appropriateness

Right information for intended stakeholders. Addresses their needs and helps them perform their job.

โœ… Correctness

Content must be accurate and up-to-date at all times.

โšก Efficiency

Strive for brevity and conciseness. Reflected in structure, organization, language, and content.

๐Ÿ”ง Maintainability

Easy to keep updated as the system evolves.

Level of Detail โ€” How Much Documentation Is Enough?

One of the most common mistakes is creating too much documentation (burdensome, outdated quickly) or too little (unhelpful, dangerous). The right level of detail depends on the audience, the project, and the criticality of the decision.

High-level architecture
Structure & interaction of components
โ†
Software Architecture
Documentation
โ†’
Detailed architecture
Detailed description of components, interfaces & design decisions
โš  High risk โ†’ more extensive documentation
Other Factors Determining Detail Level
๐Ÿ“ Scope
The scope and scale of the project dictates how much documentation is required.
โš™๏ธ Technical Complexity
More complex components warrant deeper documentation.
๐Ÿ“‹ Compliance
Regulatory or contractual requirements may mandate specific documentation levels.
๐Ÿ“„ Basic Documentation
  • โ†’Building blocks
  • โ†’Interaction of building blocks
  • โ†’Source code structure
  • โ†’Technical infrastructure
  • โ†’Basic assumptions, decisions, technologies & concepts
๐Ÿ“‘ Additional Documentation
Tailored to different recipients:
๐Ÿ‘ค Customers ๐Ÿ“… Managers ๐Ÿ’ป Developers ๐Ÿ–ฅ๏ธ Administrators

The guiding principle: Document decisions (why), interfaces (how), constraints (what you cannot change), and risks (what could go wrong). Skip obvious implementation details that the code already expresses.

๐Ÿ“ˆ Too Much Documentation
๐Ÿ“‰ Too Little Documentation
  • Hard to maintain and keep current
  • Readers stop reading it entirely
  • Becomes outdated quickly
  • Expensive to produce and update
  • Hides important content in noise
  • Knowledge siloed in individuals' heads
  • New developers cannot onboard
  • Decisions are forgotten or repeated
  • Interface misunderstandings and bugs
  • Architecture drifts without guidance
๐Ÿ“‹ Chapter 1 โ€” Summary
  • Importance of documentation โ€” directly impacts the cost of:
    • Maintaining our system
    • Evolving our system
  • Verbal communication and written communication/documentation complement each other
  • Levels of detail for documentation
  • Quality requirements for software architecture documentation:
    • Understandability
    • Appropriateness
    • Correctness
    • Efficiency
    • Maintainability
02
Chapter Two

Template-Based Documentation

Why Template-Based Documentation?

Easy to get overwhelmed and not know where to begin.

Open Questions
? Where should I start?
? What documents should I include?
? What order should I organize those documents?
Possible Solution

Use an existing template.

๐ŸŒ
General template
Applicable to any project or domain
๐Ÿญ
Industry-specific template
Tailored to a particular sector (finance, healthcare, etc.)
๐Ÿข
Company-specific template
Aligned to internal processes and standards
Why Use a Template?

Without a template, architecture documentation is ad-hoc: each project invents its own structure, readers never know where to find things, and critical sections are frequently omitted. A standardized template solves these problems by providing a proven, reusable structure.

๐Ÿ“

Consistent Structure

Readers know where to find information โ€” context, decisions, risks โ€” regardless of which project they're working on.

๐Ÿ”–

Completeness Prompt

The template reminds the architect of important sections they might otherwise forget โ€” especially risks, glossary, and quality requirements.

โšก

Speed

No need to design a documentation structure from scratch every project. Focus your effort on content, not format.

arc42 โ€” The Standard Template

arc42 (created by Gernot Starke and Peter Hruschka) is the de-facto standard template for architecture documentation, endorsed by iSAQB and widely used in Europe. It provides a proven structure of 12 sections covering everything from goals to deployment to risks.

arc42 โ€” Overview
โ†’ Supports software and system architects
โ†’ Template for development, documentation, and communication of software architectures
โ†’ Can be applied to a variety of documentation technologies and tools
โ†’ Available in many languages, with and without documentation guidelines
โœ“ Free, even for commercial applications

You don't need to fill every arc42 section for every project. Use what's relevant. A small project might only need sections 1, 3, 5, and 8. A large enterprise system may use all 12 in depth. arc42 is a template, not a mandate.

arc42 โ€” 12 Sections
WHY WHAT HOW 1 ๐ŸŽฏ Introduction and Goals What are we building, for whom, and why? Key stakeholders & quality goals. 2 ๐Ÿ”’ Architecture Constraints Technical, organizational, and political constraints that must be respected. 3 ๐ŸŒ System Scope and Context Business & technical context. Who/what interacts with our system (context view). 4 ๐Ÿ’ก Solution Strategy Fundamental technology choices and key architecture decisions. The "why" behind the approach. 5 ๐Ÿ—๏ธ Building Block View Static decomposition into hierarchical levels of building blocks. The backbone of the docs. 6 โฑ๏ธ Runtime View Dynamic behavior for key scenarios. Sequence or activity diagrams showing system in action. 7 ๐Ÿ–ฅ๏ธ Deployment View Infrastructure, nodes, and network topology. How and where the system runs. 8 ๐Ÿ”„ Cross-cutting Concepts Logging, security, error handling, persistence, UI patterns โ€” horizontal concerns. 9 โš–๏ธ Architecture Decisions Significant decisions captured as ADRs โ€” context, decision, and consequences. 10 ๐Ÿ“Š Quality Requirements Quality tree and quality scenarios โ€” making quality goals concrete and measurable. 11 โš ๏ธ Risks and Technical Debt Known risks with probability and impact. Tracked technical debt items. 12 ๐Ÿ“– Glossary Definitions of important domain and architecture terms. Eliminates ambiguity.
arc42 in Practice โ€” Section Groups
๐ŸŽฏ

Why? (Sections 1โ€“4)

  • Goals and quality requirements
  • Constraints and boundaries
  • System context
  • Solution strategy
๐Ÿ—๏ธ

What? (Sections 5โ€“8)

  • Static structure (building blocks)
  • Dynamic behavior (runtime)
  • Deployment (infrastructure)
  • Cross-cutting concerns
๐Ÿ“Œ

How? (Sections 9โ€“12)

  • Architecture decisions (ADRs)
  • Quality scenarios
  • Risks & technical debt
  • Glossary
๐Ÿ“‹ Chapter 2 โ€” Summary
  • Templates solve the problem of ad-hoc, inconsistent documentation
  • arc42 is the ISAQB-endorsed standard with 12 sections
  • Sections 1โ€“4: Why (goals, constraints, context, strategy)
  • Sections 5โ€“8: What (building blocks, runtime, deployment, cross-cutting)
  • Sections 9โ€“12: How (decisions, quality scenarios, risks, glossary)
  • Not all sections are required โ€” use what's relevant for your project
03
Chapter Three

Document Types, Diagrams and UML

Common Document Types

Architecture documentation is not a single artifact. It consists of multiple document types that serve different audiences and purposes. Understanding which type to use when is a key architect skill.

๐Ÿ“š
Central Architectural Description

One or more centrally located docs containing all relevant information: goals, quality requirements, views, decisions, patterns.

๐Ÿ—บ๏ธ
Architectural Overview

Summary covering only essential points. Can serve as a minimal substitute for the complete description.

๐Ÿ“‹
Document Summary

A list of all architecture-related documents in one place.

๐ŸŽž๏ธ
Overview Presentation

Slides giving an overview of the architecture or specific parts.

๐Ÿ—“๏ธ
Architecture "Wallpaper"

Many aspects on a single large output โ€” printed or flipchart, usually hung on a wall for team discussion.

๐Ÿ“˜
Guide for Documentation

Manual explaining the function, structure, and notation collection of the documentation.

๐Ÿ”ง
Technical Information

Documents for developers and testers: methodologies, code conventions, build, and test info.

Using Diagrams and Illustrations
โœ… Pros
  • +Often easier to understand
  • +Appeals to visual memory
โš ๏ธ Cons
  • โˆ’High effort to create and maintain
  • โˆ’Might be misleading if not explained properly
UML โ€” Unified Modeling Language

UML is the most widely known notation for architecture and design diagrams. The iSAQB curriculum emphasizes that UML is not mandatory โ€” what matters is that your notation is consistent and includes a legend. That said, UML literacy is expected of software architects.

A clear, informal box-and-arrow diagram with a legend is better than a technically perfect UML diagram that nobody understands. Consistency and clarity matter more than notation purity.

UML Structural Diagrams

Structural diagrams show the static structure of the system โ€” components, classes, packages, and their relationships.

๐Ÿ”ฒ Component Diagram

Components, interfaces & dependencies โ€” used for building block views.

OrderService PaymentService ยซinterfaceยป InventoryDB
๐Ÿ—๏ธ Deployment Diagram

Nodes, artifacts & infrastructure โ€” shows where components run.

ยซnodeยป Web Server ยซartifactยป frontend.war ยซnodeยป DB Server ยซartifactยป postgres.db TCP/5432 Deployment View โ€” shows infrastructure
๐Ÿ“ฆ Class Diagram

Classes, attributes, methods & relationships โ€” domain models & key interfaces.

Animal - name: String + speak(): void Dog + speak(): void Cat + speak(): void
๐Ÿ“ Package Diagram

Code organized into packages/modules โ€” layered or modular architecture.

ยซlayerยป UI ยซlayerยป Service ยซlayerยป Domain depends on depends on
UML Behavioral Diagrams

Behavioral diagrams show the dynamic behavior of the system โ€” how components interact, how processes flow, and what happens over time.

โฑ๏ธ Sequence Diagram

Object interactions over time โ€” best for runtime views & request/response flows.

Client API DB GET /orders SELECT * rows[] 200 OK
๐Ÿ”„ Activity Diagram

Workflow & process flow โ€” supports parallel flows (fork/join).

Receive Order Check Stock Charge Card
๐Ÿ‘ค Use Case Diagram

System features from user perspective โ€” actors + use cases + associations.

ยซsystemยป Shopping App Browse Products Place Order Customer
๐Ÿ”€ State Machine Diagram

Lifecycle of an object โ€” states, transitions & events (order lifecycle example).

Pending Paid Shipped Cancelled pay ship cancel
Key UML Relationships
UML Relationships โ€” Reference
Class A Class B Association A knows about B ยท generic relationship Class A Class B Dependency ยซusesยป A uses/depends on B ยท dashed arrow Sub Super Generalization (Inheritance) Sub inherits from Super ยท open triangle Class ยซinterfaceยป Realization (Implements) Class implements an interface ยท dashed + open triangle Whole Part Composition Whole owns Part ยท filled diamond ยท Part cannot exist alone Multiplicity: 1 (exactly one) ยท 0..1 (zero or one) ยท * (zero or many) ยท 1..* (one or many)
Beyond UML โ€” Other Notations
๐Ÿข

ArchiMate

Enterprise architecture modeling language (The Open Group). Models business, application, and technology layers. Richer than UML for enterprise-level views.

opengroup.org/archimate

๐Ÿ”

BPMN

Business Process Model and Notation โ€” a standardized method to visually model and represent business processes. Allows business analysts and developers to share a common notation.

bpmn.org

๐Ÿ“ฆ

C4 Model

Four levels of abstraction: Context โ†’ Containers โ†’ Components โ†’ Code. Notation-agnostic and practical. Widely adopted for modern software architecture communication.

c4model.com

โœ๏ธ

Informal Notations

Box-and-arrow diagrams, whiteboard sketches, and informal notations are perfectly acceptable as long as they are consistent and include a legend.

๐Ÿ“‹ Chapter 3 โ€” Summary
  • Document types:
    • Central architectural description
    • Architectural overview
    • Document Summary
    • Overview presentation
    • Architecture "wallpaper"
    • Guide for Documentation
    • Technical information
  • Pros and Cons of using visual diagrams
  • Common UML diagrams:
    • Structural:
      • Class Diagram
      • Package Diagram
      • Component Diagram
      • Deployment Diagram
    • Behavioral:
      • Sequence Diagram
      • Activity Diagram
      • State Diagram
  • You can also use flow charts, (numbered) lists, pseudo code etc.
04
Chapter Four

Documenting Views & Cross-Cutting Concerns

Why Multiple Views?

A software system is too complex to capture in a single diagram. Trying to show everything at once โ€” components, data flows, deployment nodes, interactions โ€” creates an incomprehensible mess. The solution is multiple views, each showing the system from a different perspective for a different audience.

Think of it like architectural blueprints for a building: floor plans, electrical diagrams, plumbing layouts, and structural drawings all describe the same building, but each serves a different audience and shows different concerns. No single view is "the architecture."

View-Based Architecture Development

The four core iSAQB views are not isolated โ€” they are interconnected. Every view informs and depends on the others. The Building Block View sits at the centre, refined by the Context, Runtime, and Deployment views through bidirectional feedback.

View-Based Architecture Development
Context view Building block view Runtime view Deployment view
The Four Core iSAQB Views
๐ŸŒ Context View
  • โ†’ System as a black box in its environment
  • โ†’ Defines external actors, systems & interfaces
  • โ†’ Establishes the system boundary
  • โ†’ Typically the first view to create
  • Audience: all stakeholders ยท UML: Component diagram
System Context Boundary Your System ๐Ÿ”ฒ black box User Payment API Legacy DB
๐Ÿ—๏ธ Building Block View
  • โ†’ Static decomposition into hierarchical levels
  • โ†’ Each block: black box with white box refinements
  • โ†’ Backbone of architecture documentation
  • โ†’ Level 1 โ†’ Level 2 โ†’ Level 3 โ€ฆ
  • Audience: developers, architects ยท UML: Component
Level 1 ยซsystemยป Level 2 UI Layer Service Data Level 3 OrderSvc UserSvc decomposition continuesโ€ฆ
โฑ๏ธ Runtime View
  • โ†’ Dynamic behavior for key scenarios
  • โ†’ How components interact at runtime
  • โ†’ Reveals concurrency, timing & failure modes
  • โ†’ Message flows, request-response sequences
  • Audience: devs, testers ยท UML: Sequence diagram
Client API DB POST /order INSERT id: 42 UPDATE stock 201 Created
๐Ÿ–ฅ๏ธ Deployment View
  • โ†’ Infrastructure & where software runs
  • โ†’ Nodes, network topology & artifacts
  • โ†’ Scaling, redundancy & distribution
  • โ†’ Cloud deployments, microservices infrastructure
  • Audience: operations, DevOps ยท UML: Deployment
๐ŸŒ Internet ยซnodeยป Web App frontend.war ยซnodeยป API Server api-service.jar ยซnodeยป Database postgres.db HTTP JDBC Production Zone โ€” AWS eu-central-1
The Four Views โ€” At a Glance
Context View System as black box External interfaces System boundary all stakeholders Building Block Static decomposition Hierarchical levels Black/White box developers, architects Runtime View Dynamic behavior Key scenarios Sequence/Activity devs, testers Deployment View Infrastructure Nodes & network Where it runs operations, DevOps
Additional (Specialized) Views

Provide additional views according to stakeholder needs.

Examples
  • โ†’High-level architecture for communication to management
  • โ†’Data view
  • โ†’Security view
Considerations
  • โš Views are interdependent
  • โš Changes to one view can have an impact on other views, either positive or negative
  • โš Ensure architecture views are updated in each iteration of an iterative approach
  • โœ“The four presented view types are usually sufficient
Cross-Cutting Concerns

Cross-cutting concerns are topics that apply across all building blocks and cannot be assigned to a single component. They must be documented separately and applied consistently throughout the system โ€” typically in arc42 Section 8.

๐Ÿ“

Logging & Monitoring

What is logged? Which format? Where? Centralized vs distributed. Which monitoring tools? Alerting thresholds.

๐Ÿ”’

Security

Authentication, authorization, encryption, input validation, data privacy, audit trails. Applied consistently across all components.

โš ๏ธ

Error Handling

How are errors propagated? What is the error format? How are failures recovered from? Circuit breakers, retries, fallbacks.

๐Ÿ’พ

Persistence

Which database type and technology? ORM or direct SQL? Transaction management. Data migration strategy.

๐Ÿ”„

Communication

Synchronous vs asynchronous. REST, gRPC, message queues. Serialization format (JSON, Protobuf). Retry and timeout policies.

๐ŸŒ

Internationalization

Multi-language support, locale handling, date/time formats, character encoding. Applied across all UI components.

Cross-cutting concerns are often implicit until they cause problems. Explicitly documenting them in Section 8 of arc42 prevents inconsistent implementations across building blocks and teams.

Document Cross-Cutting Concerns โ€” Suggested Structure
1 Outline the tasks and requirements to be fulfilled by the solution approach
2 Identify the constraints on the solution
3 Present the solution approach โ€” if possible, with code examples ("reference implementation")
4 Specify, and provide the rationale for, the structures and dynamic behavior
5 Provide supporting references (literature, web resources, standards) as rationale for the decisions
6 Specify risks, trade-offs, and side effects
7 Describe the alternatives that were considered and why they were rejected
Cross-Cutting Concerns Documentation โ€” Example: Persistence
1. Tasks and Requirements

The persistence layer is responsible for managing the storage, retrieval, and update of data throughout the software application. Key requirements include:

  • โ†’Data Access: Efficient and secure access to stored data.
  • โ†’Data Integrity: Ensure data is accurately stored and retrieved without corruption.
  • โ†’Abstraction from Database: The solution should abstract away the implementation of the storage technology from the application code.
  • โ€ฆ
2. Solution Constraints
  • โ†’Technology Compatibility: The solution must integrate seamlessly with the existing technology stack. (Java, PostgreSQL)
  • โ†’Open Source and Community Support.
3. Solution Approach

ORM (Object-Relational Mapping) with JPA: Use Hibernate ORM for mapping application domain objects to the relational database tables.

Code Example โ€” Java
try {
    session.beginTransaction();
    Long studentId = 2L;
    Student student = session.get(Student.class, studentId);
    if (student != null) {
        System.out.println("Found: " + student.getName());
    } else {
        System.out.println("No student found with ID " + student.getId());
    }
    session.getTransaction().commit();
} finally {
    session.close();
    sessionFactory.close();
}
4. Supporting References
๐Ÿ“˜ Hibernate ORM Documentation ๐ŸŒฑ Spring JPA
5. Risks, Trade-offs, and Side Effects
  • โš Performance Overhead: ORM can introduce overhead, particularly with complex queries or large datasets, impacting performance.
  • โš Complexity in Transaction Management: Managing transactions can become complex, especially in distributed systems.
  • โ€ฆ
6. Alternatives Considered
  • โœ—JDBC Direct Usage: Considered for its performance and control over SQL execution but rejected due to higher development effort and potential for SQL injection vulnerabilities.
  • โ€ฆ
๐Ÿ“‹ Chapter 4 โ€” Summary
  • Revisited the four views:
    • Context view
    • Building block view
    • Runtime view
    • Deployment view
  • Elements, notations and diagrams for documenting those views
  • Template for documenting cross-cutting concerns
05
Chapter Five

Documenting Interfaces and Design Decisions

Why Document Interfaces?

Interfaces are the contracts between building blocks. They define how components interact, what data they exchange, and what behaviors they guarantee. A well-documented interface enables components to evolve independently โ€” teams can work in parallel without stepping on each other.

โš ๏ธ

Without Interface Documentation

  • Teams make conflicting assumptions
  • Integration issues discovered late (expensive)
  • No clear contract โ†’ implementation drifts
  • Changing an interface breaks unknown consumers
โœ…

With Interface Documentation

  • Teams can work in parallel with confidence
  • Contracts are enforced at integration time
  • Changes to interfaces are explicit and tracked
  • New team members understand integration points
Documentation of Interfaces โ€” What Is Important?
  • โ†’ Well-designed and documented internal and external interfaces are the backbone of a maintainable architecture.
  • โš  Specification of external interfaces can require a lot of effort.
Considerations
  • โ†’Plan for API evolution and versioning if necessary
  • โ†’Use tools (e.g., Swagger) or API description languages when appropriate
  • โ†’Test cases can be a resource for interface documentation
  • โ†’Some stakeholders may require a stand-alone interface documentation
  • โ†’Provide templates for interface documentation with a common structure
Documentation of Interfaces โ€” Example Template
Title Content
Identification Exact name and version of the interface
Provided resources Resources that are provided by the interface
โ€ข Syntax of resource: API, Method signature
โ€ข Semantic of resource
โ€ข Impact of calling the resource โ€” triggered events, changed data, altered states, other side effects, restrictions on use
Error scenarios Description of error scenarios and their handling
Variability and configurability Changeability or configurability of the behavior (e.g. via configuration parameters)
Quality attributes Required quality attributes (availability, performance, security, โ€ฆ)
Design decisions Rationale for the interface design decisions and rejected alternatives
Notes Additional notes, usage examples
Title Content โ€” Example: Customer Management API
Identification โ€ข Name: Customer Management API
โ€ข Version: 1.8
Provided resources โ€ข GET /customers/{customerId} โ€” Retrieves detailed information about a customer by their unique identifier.
โ€ข DELETE /customers/{customerId} โ€” Deletes a customer's information from the system.
Error scenarios โ€ข Customer Not Found: Returns a 404 with "Customer not found."
โ€ข Invalid Customer ID: Returns a 400 if the ID format is invalid.
โ€ข Unauthorized Access: Returns a 403 if the API key is missing or invalid.
Variability and configurability โ€ข API Key Expiry: API keys can be configured to expire after a certain period, adjustable via the administration panel.
โ€ข Permission Levels: Access can be configured based on user roles, determining which operations (read, delete) are permitted.
Quality attributes โ€ข Availability: The API aims for 99.9% availability.
โ€ข Performance: Response time should not exceed 500ms.
โ€ข Security: All data transmissions are encrypted using TLS. API access is guarded by API keys and role-based access control.
Design decisions โ€ข RESTful Approach: Chosen for its statelessness and scalability
Notes โ€ข โ€ฆ
What to Document in an Interface
๐Ÿ“‹

Syntax / Contract

  • Method or endpoint signatures
  • Input and output data types
  • Required vs optional parameters
  • Versioning strategy
โš™๏ธ

Behavior / Semantics

  • Pre-conditions (what must be true before calling)
  • Post-conditions (what is guaranteed after calling)
  • Side effects
  • Idempotency / ordering guarantees
โš ๏ธ

Error Handling

  • What error codes are returned?
  • What does each error mean?
  • How should callers handle failures?
  • Timeout and retry behavior
๐Ÿ“Š

Quality Attributes

  • Expected response time
  • Throughput / rate limits
  • Availability and reliability guarantees
๐Ÿ”’

Security

  • Authentication mechanism (API key, OAuth, JWT)
  • Authorization requirements
  • Transport security (TLS)
๐Ÿ“˜

Protocol & Format

  • Communication protocol (REST, gRPC, AMQP)
  • Data serialization format (JSON, Protobuf, XML)
  • Schema version / backward compatibility
Architecture Decision Records (ADRs)

An ADR captures a single architecturally significant decision โ€” the context, the decision itself, the alternatives considered, and its consequences. ADRs are one of the most valuable documentation practices because they capture why a decision was made, not just what was decided.

Without ADRs, future team members encounter code or architecture choices and wonder "why was this done this way?" โ€” and may change it, inadvertently breaking things that were working for good reasons.

ADR Template Structure
Architecture Decision Record โ€” ADR-XXX
Title
Short descriptive name: "ADR-007: Use PostgreSQL for Order Service"
Status
Proposed โ†’ Accepted โ†’ Deprecated โ†’ Superseded by ADR-XXX
Context
The situation and forces at play. What problem needs solving? What constraints exist?
Decision
What was decided, stated clearly and concisely. Not just what โ€” but why.
Consequences
Both positive and negative outcomes. Be honest about trade-offs and risks accepted.
Alternatives
Other options considered and why they were rejected. Prevents revisiting closed decisions.
ADR โ€” Example
๐Ÿ“˜

ADR-003: Use Event-Driven Architecture

Status: Accepted

Context: Multiple services need to react to order state changes. Direct REST calls create tight coupling and synchronous failures.

Decision: Use Apache Kafka as a message broker. Services publish events; consumers react asynchronously.

Consequences (+): Loose coupling, independent scalability, resilience to service downtime.

Consequences (โˆ’): Eventual consistency, operational complexity, new learning curve.

๐Ÿ“—

ADR-007: PostgreSQL for Order Service

Status: Accepted

Context: Order data is relational โ€” customers, products, line items. ACID compliance required for financial integrity.

Decision: Use PostgreSQL 15 for the Order Service database.

Consequences (+): Full ACID, strong schema, mature tooling, team familiarity.

Consequences (โˆ’): Horizontal scaling requires sharding; not ideal for unstructured data.

Alternatives rejected: MongoDB (no ACID by default), DynamoDB (vendor lock-in).

ADR Lifecycle
๐Ÿ“ Proposed
โ–ถ
Decision is being discussed and reviewed
โœ… Accepted
โ–ถ
Decision is finalized and in effect
โŒ Deprecated
โ–ถ
No longer recommended but not superseded
๐Ÿ”„ Superseded
โ–ถ
Replaced by a newer ADR (reference provided)
github.com/adr โ€” ADR templates Michael Nygard โ€” "Documenting Architecture Decisions" (2011) adr.github.io
๐Ÿ“‹ Chapter 5 โ€” Summary
  • Revisited the importance of well-designed and documented interfaces
    • โ†’ "Well-designed and documented internal and external interfaces are the backbone of a maintainable architecture."
  • A common template for documenting interfaces
  • Documenting design decisions and their rationale
    • Common format: ADR (Architecture Decision Record)
06
Chapter Six

Documentation Best Practices

9 Best Practices for Documentation
1 ๐Ÿ“ Use a Standardized Structure

Use standardized structures and templates:

  • โ†’Uniform documentation with consistent structure
  • โ†’Increases efficiency to create and use
  • โ†’What is missing? What do I have to document? Where?
  • โ†’Quality assurance: all aspects to be covered are defined in advance
Provide templates for
๐Ÿ—๏ธ Building blocks & structures โš–๏ธ Architecture Decisions (ADRs) ๐Ÿ”— Interfaces ๐Ÿ”„ Cross-cutting Concerns

โš  Ensure compliance with the structure!

2 ๐Ÿ‘“ Write From the Readers' Perspective
Ask yourself:
  • ?Is the information clear?
  • ?Are the readers' requirements satisfied?
Get feedback from target groups:
Customers Developers Operations

๐Ÿ’ก Less is more! Time investment on concise writing saves readers valuable time.

  • โ†’Write thoughts and ideas in a logical or required sequence
  • โ†’Use active voice: โœ“ "The application verifies the user input" ยท โœ— "The user input is verified by the application"
  • โ†’KISS: Avoid unnecessary technical jargon
  • โ†’Explain technical terms
3 โœ‚๏ธ Avoid Repetitions and Redundancy
  • โ†’Avoid unnecessary repetition!
  • โ†’Simplifies the use of documentation
  • โ†’Increases efficiency
  • โ†’Reduces effort for maintenance and changes

โš  Documentation from different perspectives can lead to redundancy but is necessary to increase understandability.

4 ๐ŸŽฏ Avoid Ambiguity

Ambiguity can lead to inefficient conversations due to different interpretations.

  • โ†’Use formal description languages if applicable
  • โ†’Use self-descriptive names for domain objects
  • โ†’Link to a glossary for an explanation of terms
  • โ†’Verify if things can be misunderstood
5 โš–๏ธ Provide a Rationale for Decisions

Helps readers understand the architecture decisions and their implications.

  • โ†’A decision includes the reasoning that led to that decision
  • โ†’Advantages/disadvantages of decisions are usually not obvious

Provide a written justification of important decisions to:

  • โ†’Traceability back to requirements and constraints increases understanding
  • โ†’Eliminate endlessly repetitive discussions
  • โ†’Save time when decisions need to be reconsidered when conditions change

Also track: Explicitly rejected alternatives โ€” and why they were rejected.

6 ๐Ÿ–ผ๏ธ Unclutter Diagrams

"Illustrations should not impress but enlighten."

  • โ†’Avoid too large or too complex diagrams
  • โ†’Consider the 7 ยฑ 2 rule โ€” 5โ€“9 elements in diagrams are an optimum for understandability
  • โ†’Exception: "architectural wallpaper"

Provide a description for diagrams and a legend (element catalog).

7 ๐Ÿ”„ Keep Documentation Current

Regularly update documentation during development and maintenance!

Lack of a consistently used maintenance process for documentation leads to:

  • โœ—Inconsistent and outdated documentation
  • โœ—Reduced benefit and usage of documentation
  • โœ—Unnecessary inquiries from other stakeholders (especially architects or developers)
  • โœ—Decreased motivation for creating and maintaining documentation

๐Ÿ’ก Do not update too often when design decisions change frequently โ€” establish fixed, timely synchronization periods.

8 ๐Ÿ“Š Communicate Status & Validity of Documentation

Documentation evolves! โ€” How current/outdated is the given information?

Pro Tip โ€” Change Log at the beginning of ALL documents
๐Ÿ“… Date and version โœ๏ธ Author of changes ๐Ÿ“„ Sections/topics changed
  • โ†’Establish version control for documentation as well
  • โ†’How stable is it? Are changes to be expected?
9 โœ… Check for Suitability

Perform reviews before publishing!

  • โ†’Only the target user group can decide whether the right information is presented in the right way
  • โ†’Let representatives of the target group participate in the documentation process
  • โ†’New team members are a valuable source for feedback

๐Ÿ’ก Implement an improvement process for documentation.

๐Ÿ“‹ Chapter 6 โ€” Summary
  • Covered industry-proven best practices for high quality documentation:
    • Use Standardized Structure
    • Write From the Readers' Perspective
    • Avoid Repetitions and Redundancy
    • Avoid Ambiguity
    • Provide a Rationale for Decisions
    • Unclutter Diagrams
    • Keep Documentation Current
    • Communicate the Status and Validity of Documentation
    • Check for Suitability
Summary โ€” Communication & Documentation at a Glance
01 ยท Goals & Benefits

Why Document?

  • Communicate decisions to all stakeholders
  • Preserve knowledge beyond individual memory
  • Written + verbal communication complement each other
02 ยท Template-Based

Structured Documentation

  • arc42 โ€” 12-section template for architecture docs
  • Consistent structure reduces cognitive load
  • Tailor depth to audience and project size
03 ยท Diagrams & UML

Visual Communication

  • UML class, component, sequence & deployment diagrams
  • Know key UML relationships (association, dependency, inheritance)
  • Diagrams reduce ambiguity โ€” one picture, many words
04 ยท Views & Cross-Cutting

Multiple Perspectives

  • Context, building block, runtime & deployment views
  • Each view serves a different stakeholder concern
  • Document cross-cutting concepts separately
05 ยท Interfaces & Decisions

Document What Matters

  • Document all external & key internal interfaces
  • Record architecture decisions with rationale (ADRs)
  • Capture alternatives considered & trade-offs made
06 ยท Best Practices

Documentation Done Right

  • Write from the reader's perspective
  • Avoid repetition, ambiguity & clutter
  • Keep docs current & communicate their validity