What Software Architecture Is, Why It Exists, What an Architect Does
"Architecture is about the important stuff. Whatever that is." — Ralph Johnson, as quoted by Martin Fowler, Software Architecture Guide
Summary: Software architecture is the set of structures, quality goals and decisions that are expensive to reverse; it exists so a system can change safely, so people can talk about it, and so the "-ilities" are chosen on purpose instead of by accident. Focus: Four definitions (Bass/Clements/Kazman, ISO/IEC/IEEE 42010, Fowler/Johnson, Richards/Ford), why architecture exists, architecture versus infrastructure versus design, architecture characteristics and the trade-off laws, the architect's role and archetypes, architecture in agile teams, documenting and evaluating it, evolutionary architecture, failure modes, and a minimal "architecture as code" setup in Go and Laravel. Learning goal: Given a system and a decision, say whether it is architectural, which characteristic it serves and which it hurts, who should make it, where it is recorded, and which automated check keeps it true; and know which of the 21 chapters of this path teaches the next step.
This is the entry page of the Architecture path. It teaches vocabulary and habits, not a single style. The border with the Design path is drawn in Software Architecture vs Software Design; we do not repeat it here (levels of design, SWEBOK stages, the cost-of-change curve, technical debt). The border with System Design (load, scaling, building blocks) is in the System Design path. The rest of this path follows the reading map.
Page map
| If you are looking for | Go to |
|---|---|
| The whole page in a few tables | Everything in one minute |
| Why architecture exists at all | Why it exists |
| Bass, ISO 42010, Fowler, Richards and Ford side by side | Definitions |
| Where the word comes from | Where it comes from |
| "-ilities", quality attributes, characteristics | Architecture characteristics |
| Architecture vs infrastructure vs design | Three words, three scopes |
| "Everything is a trade-off" | The laws |
| What an architect does all day | The architect's role |
| Enterprise, solution, application, technical lead | Archetypes |
| Ivory tower vs hands-on | Ivory tower vs hands-on |
| Architecture in agile teams | Agile, runway, last responsible moment |
| Views, C4, ADRs | Documenting |
| ATAM, fitness functions | Evaluating |
| Evolutionary architecture | Evolutionary architecture |
| Resume-driven design, big-bang rewrite, cargo cult | Failure modes |
| All 21 chapters of this path | Reading map |
| Code: module layout, dependency rules, fitness test | Go, Laravel |
| Monolith to distributed | In architecture |
| Exercise | Lab |
| Wrong beliefs, cheat sheet, questions, terms | Misconceptions, Cheat sheet, Self-check, Glossary |
Everything in one minute
The vocabulary. Every row is unpacked below.
| Term | In plain words | Tiny example | What goes wrong without it |
|---|---|---|---|
| Architecture | The structures and decisions that are hard to change, and the reasons for them | "One deployable, two modules, one PostgreSQL" | Nobody can say why the system looks like this |
| Structure | Elements and the relations between them | orders calls billing | You cannot reason about change impact |
| Architecture characteristic (quality attribute, "-ility") | A property the system must have besides features | Availability 99.9%, p95 under 200 ms | Features ship, but the system is slow, fragile or unsafe |
| Architecture decision | A choice that shapes structure or characteristics | "Billing owns its own schema" | Choices are re-argued every quarter |
| Design principle | A guideline that steers many small choices | "Modules talk through contracts only" | Each team invents its own rule |
| Architect | The person (or people) who worry about the important stuff | A senior engineer who also writes code | Either no one owns the big picture or one person owns every choice |
| Fitness function | An automated check that a characteristic or rule still holds | A test that fails when orders imports billing | Architecture erodes silently |
| ADR | One short record per significant decision | ADR-0003: dependency rule | The reasons vanish when people leave |
| Evolutionary architecture | Architecture that supports guided, incremental change | Small releases protected by fitness functions | Big-bang rewrites |
Four definitions in one table.
| Source | Definition (short) | What it emphasises |
|---|---|---|
| Bass, Clements, Kazman | Structures: elements, relations among them, properties | What you can reason about and analyse |
| ISO/IEC/IEEE 42010 | Fundamental concepts or properties of a system in its environment, embodied in elements, relationships and principles of design and evolution | The environment and the principles |
| Fowler / Johnson | The shared understanding of the expert developers; the important stuff | People and importance |
| Richards / Ford | Style, characteristics, logical components, decisions (and design principles) | What to specify and why |
Architect expectations (Richards and Ford, eight items): make decisions; analyse continually; keep current; ensure compliance; diverse exposure; business domain; interpersonal skills; navigate politics. See the wheel.
Why it exists
Every non-trivial system has a structure and a set of qualities, chosen or not. Architecture exists because four needs appear as soon as more than one person, or more than one release, is involved.
| Need | What architecture gives | Without it |
|---|---|---|
| Managing change | Boundaries that limit the blast radius of a change | A "small change" touches forty files |
| Communication | A shared vocabulary and a few pictures | Each person holds a different mental model |
| Quality attributes | Deliberate choices for latency, availability, security, cost | The qualities you did not choose are random |
| Cost of reversal | Care spent where mistakes are expensive | Expensive decisions slip through as trivia |
| Coordination of teams | Ownership lines that match teams | Merge conflicts and blocked releases |
The everyday analogy we reuse: a city plan. Streets, water mains and zoning are architecture: moving them later means digging up the city. Where a shop puts its shelves is design. Which shop opens on which corner is business. A good plan does not choose the shops; it lets any shop open without rebuilding the sewers. A bad plan, or none, still produces a city, but it is the one nobody chose. (Fowler warns that the building architect metaphor is flawed, see the role; the city-plan picture stays close to "structure that others build inside".)
Three common misunderstandings, up front
- "Architecture is the diagram." A diagram is one view. The architecture is the structures and decisions, drawn or not.
- "Architecture means microservices." Microservices are one style. A modular monolith has an architecture too; see Modular Monolith.
- "The architect decides, the team builds." Fowler's guide model is the opposite: the architect's value rises when the team can decide well.
Where it comes from
The word, 1960s to 1990s. Architecture became a discipline for software structures in the mid-1990s (SWEBOK v4 says so). Our Design chapter has the full timeline (NATO 1968, Parnas 1972, SWEBOK v4's separate architecture knowledge area); read it there.
Bass, Clements, Kazman. Software Architecture in Practice (the second edition, 2003, is quoted by the SEI's definitions page). The 2003 wording:
"The software architecture of a program or computing system is the structure or structures of the system, which comprise software elements, the externally visible properties of those elements, and the relationships among them." — Bass, Clements, Kazman, Software Architecture in Practice, 2nd ed., 2003, as published on the SEI definitions page (copy at cs.hmc.edu)
The later Views and Beyond wording is "the set of structures needed to reason about the system, which comprise software elements, relations among them, and properties of both" (secondary: seen in lecture slides quoting the book, not read in the book itself).
ISO/IEC/IEEE 42010. The standard defines architecture as "fundamental concepts or properties of a system in its environment embodied in its elements, relationships, and in the principles of its design and evolution" (iso-architecture.org, which hosts the standard's definition page and its phrase-by-phrase commentary). Its main contribution is the architecture description vocabulary: stakeholders, concerns, viewpoints, views (see 4+1 views).
Fowler, 2003, with Ralph Johnson. In Who Needs an Architect? (IEEE Software) Fowler defines architecture as the shared understanding the expert developers have of the system design, and notes that people really want to get right early "things that people perceive as hard to change". The same guide page records Johnson's objection that nothing is objectively "fundamental" and his conclusion that architecture is "the important stuff".
Richards and Ford. Fundamentals of Software Architecture (O'Reilly; the notes we read are from the early-release second edition, February 2025) gives the practitioner view. The second edition, per a reader's chapter notes (secondary), says the definition "has four dimensions": an architecture style, the characteristics it must support, the logical components, and the architecture decisions that justify it all. Earlier editions phrase it as structure, characteristics, decisions and design principles (we did not read the book text; see references).
Agile and evolution, 2001 onwards. Architecture left the big-document era: ADRs (Nygard, 2011), the architectural runway (SAFe), and the evolutionary architecture book (Ford, Parsons, Kua) describe architecture as something that changes continuously under automated checks.
The concepts, one by one
Definitions: structures, environment, shared understanding Must-know
In plain words: four people describe the same elephant: Bass looks at the parts and links, ISO at the system in its surroundings, Fowler at what the experts know, Richards and Ford at what you must write down.
Common misunderstanding: "One of these is the right definition and the others are wrong." They answer different questions; use the one that fits your task (analysis, description, conversation, specification).
Definition (our working one): Software architecture is the set of structures of a system (elements, their relationships and visible properties), the characteristics it must have, and the decisions and principles that justify them, as understood by the people who build it.
| Question you are asking | Use this definition | Why |
|---|---|---|
| "Can we predict the effect of this change?" | Bass et al.: structures and properties | Structures are analysable |
| "What must a document or a review cover?" | ISO 42010: concepts, environment, principles, stakeholders | A shared description standard |
| "Why does the new hire not get it?" | Fowler: shared understanding | Architecture lives in heads first |
| "What do I deliver as architect?" | Richards and Ford: style, characteristics, components, decisions | A checklist of outputs |
| "Is this decision architectural?" | Johnson: is it important, is it hard to change? | A cost test |
Step Who What happens (a definition applied to one decision)
1 1 Team Proposal: "billing gets its own database schema"
2 2 Fowler/Johnson test Important? Yes: many teams depend on the data. Hard to change later? Yes.
3 3 Bass test Structure: new element "billing schema"; relation: orders no longer joins into it
4 4 Richards/Ford test Characteristic served: deployability, evolvability; decision recorded as ADR-0003
5 5 ISO 42010 test Stakeholders: finance team (concern: audit), operations (concern: backups)Real scenario: a payment team argues for a week about "architecture" before noticing one person means the deployment diagram and another means the dependency rule. Naming which definition is in play ends the argument.
What provides it: a one-page "architecture overview" in the repository, an ADR folder, a C4 context diagram, and onboarding that makes a new person redraw the system from memory.
Fix / how to use it: keep a one-sentence definition in your team's docs and list your architecturally significant decisions (the five most expensive to reverse). See Architecture Decisions.
Architecture characteristics ("-ilities") Must-know
In plain words: features say what the system does; characteristics say how well: how fast, how available, how safe, how easy to change.
Common misunderstanding: "We need all of them, maximised." Each one costs structure and money, and many conflict. Richards and Ford (reader notes): a characteristic is architectural when it "influences some structural aspect of the design" and needs special structural support; security can be handled by coding hygiene in a monolith but needs a hardened service in a distributed system.
Definition: a non-functional property that the architecture must support, drives structural choices and is measured against a goal. Synonyms: quality attribute (SEI, ISO/IEC 25010 vocabulary), non-functional requirement, "-ility". Detailed requirement work is in Quality Attributes and From Requirements to Architecture.
| Characteristic | Plain meaning | How you measure it | Structural lever (example) |
|---|---|---|---|
| Availability | Up when needed | Uptime %, error budget (SLOs) | Redundancy, failover, no single point of failure |
| Scalability | Handles growth in load | Requests/s at fixed p95 | Stateless services, sharding |
| Elasticity | Handles bursts, then shrinks | Time to add capacity | Autoscaling, queues |
| Performance | Fast enough | p50/p95/p99 latency | Caches, fewer network hops |
| Reliability / fault tolerance | Correct despite faults | Failure rate, MTBF | Retries with idempotency, bulkheads |
| Security | Resists misuse | Findings, time-to-patch | Trust boundaries, least privilege |
| Deployability | Ship safely and often | Lead time, change failure rate | Independent deployable units |
| Testability | Cheap to verify | Coverage of risky paths, test time | Dependency inversion, seams |
| Modifiability / evolvability | Cheap to change | Files touched per change | Modules, contracts, fitness functions |
| Observability | Explains itself in production | Time to diagnose | Logs, metrics, traces |
| Cost | Affordable to run | Cost per request | Right-sized components |
| Learnability | New people become productive | Days to first merged change | Fewer, clearer parts |
Step Event Characteristic in tension
1 1 Product asks for sub-100 ms search Performance -> add a cache and a read replica
2 2 Cache is stale for 30 s Consistency suffers (accepted in ADR-0011)
3 3 Replica adds an operational component Cost and operability suffer
4 4 Black Friday doubles traffic Elasticity tested; autoscaling rule addedReal scenario: a ticket-booking system picks consistency over availability for seat allocation (no double sale) but availability over consistency for the "seats left" counter on the browse page.
What provides it (per technology): PostgreSQL gives strong consistency and SERIALIZABLE; Redis gives low latency with weaker durability by default; Kafka gives high write throughput and replay; Kubernetes gives elasticity; none gives all of them.
Fix / how to use it: pick the top three characteristics per system, write each as a measurable scenario ("p95 under 200 ms at 500 req/s"), and make each a fitness function where possible (see fitness functions). Trying to optimise all twelve produces the "generic architecture" that serves none.
Three words, three scopes: architecture, infrastructure, design Important
In plain words: architecture decides the shape, infrastructure is the ground it stands on, design fills the rooms.
Common misunderstanding: "Choosing AWS or Kubernetes is the architecture." Those are infrastructure choices that constrain architecture; the architecture is what you build on them and how it is split.
| Aspect | Architecture | Infrastructure | Design |
|---|---|---|---|
| Question | How is the system split and what must it guarantee? | Where and on what does it run? | How does this part work inside? |
| Examples | Modular monolith, data ownership, sync vs async | Kubernetes, VMs, PostgreSQL cluster, Kafka cluster, CDN, VPC | Classes, interfaces, algorithms, retries inside one module |
| Owner | Architect and tech leads | Platform / SRE / cloud team | The team that owns the module |
| Reversal cost | High | Medium to high (migrations, vendor lock-in) | Low to medium |
| Artifact | ADRs, C4 context/container, characteristics | Terraform, Helm charts, runbooks | Code, tests, sequence diagrams |
| Chapter | This path | System Design path | Design path |
The overlap is real: "use Kafka" is an infrastructure choice and an architectural one (it creates asynchronous boundaries). Treat a decision as architectural when it changes structure or a characteristic, whoever pays the bill.
The laws: everything is a trade-off Must-know
In plain words: you never get a free improvement. Every gain in one characteristic is paid for somewhere else, and "it depends" is the honest starting answer.
Common misunderstanding: "A best practice exists for each problem." Fowler quotes Kent Beck: "any decent answer to an interesting question begins, 'it depends...'", then shifts the focus to what it depends on.
Definition (Richards and Ford, via a reader's notes on the early-release second edition, secondary):
| Law | Statement | Consequence |
|---|---|---|
| First law | "Everything in software architecture is a trade-off." | If you found no trade-off, you have not found it yet |
| Corollary 1 | If you think you found something that isn't a trade-off, you just haven't identified it yet | Look for the hidden cost |
| Corollary 2 | You can't do trade-off analysis once and be done | Re-check as context changes |
| Second law | "Why is more important than how." | Record the reasons (ADRs) |
| Third law | Most decisions aren't binary but sit on a spectrum between extremes | Prefer "how much" over "which" |
Step Decision Gains Pays with
1 1 Split billing into a service Independent deploys, scaling Network latency, partial failure, distributed data
2 2 Cache product pages Latency, lower DB load Stale reads, invalidation bugs
3 3 Share a library across services No code duplication Coupled releases (shared library vs shared service)
4 4 Async events between modules Decoupling in time Harder debugging, eventual consistencyReal scenario: Fowler's Microservice Premium: microservices buy independent deployment and a way to handle complexity, and cost "automated deployment, monitoring, dealing with failure, eventual consistency". Whether it pays depends on system complexity; for a simple system the premium is not worth it.
What provides it: the habit of a two-column table (gains, pays with) in every ADR, and the trade-off chapter.
Fix / how to use it: before approving a design, require the author to name one thing they give up. If the answer is "nothing", send it back.
The architect's role Must-know
In plain words: an architect is the person who worries about the important stuff and keeps the team able to change it.
Common misunderstanding: "The architect makes all the important decisions." That is what Fowler calls Architectus Reloadus. He prefers Architectus Oryzus, who collaborates, mentors, and tackles problems "before they become a serious problem", and he offers a rule of thumb: "an architect's value is inversely proportional to the number of decisions he or she makes". A colleague's alternative name for the role: guide, as in mountaineering.
Definition (Richards and Ford, eight expectations; reader's notes quoting the book):
| # | Expectation | In practice | Typical failure |
|---|---|---|---|
| 1 | Make architecture decisions | Define decisions and design principles that guide technology choices | Deciding everything, or nothing |
| 2 | Continually analyse the architecture | Review fit with the current environment, recommend improvements | Architecture frozen at day one |
| 3 | Keep current with trends | Read, try, build a personal radar | Resume-driven picks from hype |
| 4 | Ensure compliance with decisions | Verify code follows decisions (automate it, see fitness functions) | Architect as police; the reader's note doubts that governance should sit with the architect |
| 5 | Diverse exposure and experience | Breadth over depth across technologies | One favourite tool for every job |
| 6 | Business domain knowledge | Speak the domain, link design to goals | Technically perfect, commercially wrong |
| 7 | Interpersonal skills | Teamwork, facilitation, leadership | Right answer, nobody follows |
| 8 | Understand and navigate politics | Negotiate budgets, scope and ownership | Good design blocked by organisation |
Step Day of an architect (Architectus Oryzus) Expectation served
1 1 Morning: pair on shared locking code 5, 7 (breadth, collaboration)
2 2 Late morning: read a vendor's postmortem 3 (keep current)
3 3 Afternoon: requirements session, explain cost 6, 7 (domain, communication)
4 4 Review fitness-function failures in CI 2, 4 (analyse, compliance)
5 5 Write ADR for the queue choice 1 (decisions) and law 2 (why)Real scenario: a delivery team stalls on "which message broker". The architect does not pick; she runs a two-hour session with the team, writes the trade-offs into an ADR, and the team decides.
What provides it: a written decision log, an architecture forum with rotating members, a small set of principles, and CI checks instead of review gates.
Fix / how to use it: measure the role by how often teams make good architectural decisions without you.
Archetypes: enterprise, solution, application, technical lead Important
In plain words: "architect" is a job title with different scopes; ask what the person is responsible for.
Common misunderstanding: "All architects do the same thing at different seniority." Scope differs more than seniority.
The four names below are the common industry classification; we did not find them defined in the primary sources we read, so treat the exact boundaries as convention, not standard.
| Archetype | Scope | Typical decisions | Typical artifact | Coding? |
|---|---|---|---|---|
| Enterprise architect | Whole organisation, many systems | Standards, platforms, capability map, build vs buy | Landscape maps, roadmaps, policies | Rarely |
| Solution architect | One solution spanning several systems or teams | How systems integrate, which services, data flows | Solution design, integration diagrams, ADRs | Sometimes (prototypes) |
| Application architect | One application or product | Style, modules, data model, quality goals | Container/component diagrams, ADRs, fitness functions | Often |
| Technical lead | One team's codebase | Design inside modules, code standards, reviews | Code, tests, design notes | Daily |
Step Question Whose job (usually)
1 1 "Which identity provider for all products?" Enterprise architect
2 2 "How does checkout talk to payment and tax?" Solution architect
3 3 "Modular monolith or services for the shop?" Application architect (with the team)
4 4 "How do we structure the pricing package?" Technical leadReal scenario: a retailer's enterprise architect picks Kafka as the event backbone; the solution architect defines the order-event contracts; the application architect decides the shop publishes events through an outbox; the tech lead writes the relay.
What provides it: a clear RACI of who decides what, plus ADR scope fields ("applies to: shop", "applies to: all").
Fix / how to use it: push decisions to the lowest level that has the information; escalate only what crosses a boundary.
Ivory tower vs hands-on Important
In plain words: an ivory-tower architect draws from a distance; a hands-on architect stays close to code and learns from it.
Common misunderstanding: "Hands-on means the architect writes the critical code." That makes the architect a bottleneck. Hands-on means staying in contact: pairing, reviewing, prototyping, reading production data.
| Aspect | Ivory tower | Hands-on |
|---|---|---|
| Feedback | Slides and documents | Code, incidents, metrics |
| Decisions | Handed down early | Made with the team, near the last responsible moment |
| Documents | Large, rot quickly | Small, in the repository, tied to tests |
| Team reaction | Ignore or work around | Ask for help |
| Fowler's name | Architectus Reloadus | Architectus Oryzus (the guide) |
| Risk | Design nobody follows | Architect drowns in code, becomes a bottleneck |
Real scenario: an ivory-tower design mandates a service mesh for ten developers; the team ignores it. A hands-on architect would first measure whether the problem exists.
Fix / how to use it: a rule of thumb: spend a fixed share of time (a day a week) on real code or incident review; rotate architects through teams.
Architecture in agile: emergent vs intentional, runway, last responsible moment Must-know
In plain words: agile does not remove architecture; it changes when you decide. Decide the expensive things carefully and early enough, the cheap things late, and keep the system able to change.
Common misunderstanding: "Agile teams do not need architecture; it emerges from the code." The scaled framework SAFe says the opposite: organisations "overcome these problems by balancing emergent design with intentional architecture, which requires some centralized planning and cross-team coordination."
| Idea | Meaning | Source |
|---|---|---|
| Emergent design | Structure grows with the code, protected by tests and refactoring | Fowler, Is Design Dead?; XP |
| Intentional architecture | Deliberate decisions made ahead for large or risky parts | SAFe (Agile Architecture) |
| Last responsible moment | The moment at which failing to decide "eliminates an important alternative" | Poppendieck, Lean Software Development (quoted at Coding Horror) |
| Architectural runway (the SAFe term; we call it the architecture runway) | "Existing code, components, and technical infrastructure needed to implement near-term features with minimal redesign and delay" | SAFe definition |
| YAGNI | Do not build for speculative needs | Fowler bliki |
| Walking skeleton | A thin end-to-end slice that exercises every layer | Cockburn (term), see Design chapter |
Poppendieck's wording: "Concurrent development makes it possible to delay commitment until the last responsible moment, that is, the moment at which failing to make a decision eliminates an important alternative. If commitments are delayed beyond the last responsible moment, then decisions are made by default, which is generally not a good approach to making decisions."
Step Week Decision Why now (or not)
1 1 1 Language, repo layout, CI Cheap now, painful later; runway
2 2 1 "Modular monolith, one PostgreSQL" Hard to reverse: decide with ADR-0001
3 3 2 Payment provider API Delay: use an interface; switch at the last responsible moment
4 4 6 Message broker No async need yet: postpone (YAGNI); add outbox when needed
5 5 12 Split billing into a service? Only when a team boundary or scaling need proves itReal scenario: a startup picks a modular monolith, hides the payment provider behind an interface, and defers the broker for three months. When the second provider arrives, only the adapter changes.
What provides it: enabler stories for runway work, ADRs with "revisit when" triggers, trunk-based development, feature flags (Laravel Pennant, Unleash).
Fix / how to use it: keep a backlog of architecture decisions waiting with a trigger ("decide when traffic exceeds X" or "when a second team owns this").
Documenting architecture: views, C4, ADRs Important
In plain words: write down the parts that people need and that rot slowly: the picture of the big pieces and the reasons for the big choices.
Common misunderstanding: "More documentation is better." Nygard: big documents are never kept up to date; small modular ones "have at least a chance". Document for a reader and a purpose.
| Tool | What it captures | Detail chapter |
|---|---|---|
| Views (Kruchten 4+1) | One system seen from logical, process, development, physical and scenario viewpoints | 4+1 views |
| C4 model (Simon Brown) | Hierarchical abstractions: software systems, containers, components, code; diagrams: system context, containers, components, code | c4model.com |
| ADR (Nygard, 2011) | One decision: context, decision, consequences, status | Architecture Decisions |
| Quality scenarios | Characteristics as testable statements | Requirements to architecture |
| Fitness functions | Executable documentation of a rule | below |
| README + diagrams in repo | Entry point for a new reader | Convention |
A minimal ADR (we use this shape through the path):
ADR-0003: Modules talk through contracts only
1 Status: Accepted (2026-11-25)
2 Context: Orders and billing change at different speeds; two teams will own them
3 Decision: orders depends on its own Biller interface; billing hides internals; a test enforces both
4 Consequences: + independent changes, - one more interface to maintain; revisit if billing becomes a serviceReal scenario: a new engineer proposes merging the two modules "to remove the interface". git log docs/adr shows ADR-0003 and its trigger; the conversation takes five minutes instead of five meetings.
What provides it: docs/adr/NNNN-title.md in the repository, a C4 context diagram in the README, PR templates that ask "is this architecturally significant?".
Fix / how to use it: one context diagram, one container diagram, and an ADR per significant decision are enough to start.
Evaluating architecture: ATAM and fitness functions Important
In plain words: you can test an architecture on paper before building it (ATAM), and test the built one continuously (fitness functions).
Common misunderstanding: "Architecture review is a gate at the end." ATAM is done early (it evaluates a design against quality goals), and fitness functions are done constantly.
Definition:
- ATAM (Architecture Tradeoff Analysis Method, SEI) "a method for evaluating software architectures relative to quality attribute goals"; it "gets its name because it not only reveals how well an architecture satisfies particular quality goals but it also provides insight into how those quality goals interact with each other—how they trade off against each other". A typical evaluation takes three to four days with an evaluation team, architects and stakeholders, in nine steps. Outputs include risks, non-risks, sensitivity points and trade-off points.
- Fitness function (Thoughtworks): fitness functions "describe how close an architecture is to achieving an architectural aim"; with fitness-function-driven development "we can also write tests that measure a system's alignment to architectural goals".
| Method | When | Cost | Finds | Example |
|---|---|---|---|---|
| ATAM | Design stage, before big commitments | Days of several people | Risks, trade-off points | "Single queue is a latency sensitivity point" |
| Quality-attribute scenarios | Any time | Hours | Measurable goals | "p95 under 200 ms at 500 req/s" |
| Fitness function, structural | Every commit | Free (CI) | Rule violations | Import test, go-arch-lint, deptrac, Pest arch() |
| Fitness function, operational | Pipeline/production | Moderate | Quality drift | Latency budget in a load test, error-budget burn alert |
| Review/inspection | At milestones | Hours | Misreadings | Peer review of ADRs |
Step Pipeline stage Fitness function Fails the build when
1 1 Commit go-arch-lint / deptrac orders imports billing
2 2 Unit tests archtest: imports test A package other than main wires both modules
3 3 Integration SQL: no cross-schema foreign keys billing.* references orders.*
4 4 Load test (nightly) p95 budget p95 above 200 ms
5 5 Production SLO burn-rate alert Error budget burns too fastReal scenario: in a design review a team learns that its "one shared cache for all services" is a sensitivity point for availability; they add a per-service fallback before writing code.
What provides it: SEI's ATAM materials; for fitness functions, any CI runner plus the tools shown in Go and Laravel.
Fix / how to use it: pick two or three rules you are afraid of losing (dependency direction, data ownership, latency) and automate those first.
Evolutionary architecture Important
In plain words: build the system so it can keep changing safely, and use automated checks to steer it.
Common misunderstanding: "Evolutionary means no plan." The definition (Ford, Parsons, Kua, via Thoughtworks): "An evolutionary architecture supports guided, incremental change as a first principle across multiple dimensions." Note guided: fitness functions provide the guidance.
| Dimension | Example of incremental change | Guard (fitness function) |
|---|---|---|
| Structure | Extract a module into a service | Dependency rule tests |
| Data | Split a schema | No cross-schema foreign keys |
| Performance | Add a cache | Latency budget test |
| Security | Rotate a library | Dependency scanner in CI |
| Operations | Move hosting | Smoke and SLO checks |
Real scenario: a team moves billing from a module to a service over four releases: contract first, adapter second, data copy third, cutover fourth; each step is guarded by tests (see Service boundaries).
Fix / how to use it: make every large change a sequence of small reversible ones, each with a guard.
Common failure modes Must-know
In plain words: most architecture failures are social and economic, not technical: choosing for the CV, rewriting everything, copying someone else's setup.
Common misunderstanding: "These failures are about picking bad technology." The technology is usually fine; the reason for choosing it was wrong.
| Failure | What it looks like | Evidence or source | Counter-move |
|---|---|---|---|
| Resume-driven design | Technology chosen because the engineer wants it on a CV | Community term (not a primary source) | Require an ADR with trade-offs and a "do nothing" option |
| Big-bang rewrite | Stop and rebuild the whole system | Spolsky: Netscape made "the single worst strategic mistake that any software company can make" | Strangler approach, incremental migration |
| Cargo cult microservices | Copying Netflix-style structure without its prerequisites | Fowler: teams "too eager to embrace microservices"; his Monolith First: "Almost all the cases where I've heard of a system that was built as a microservice system from scratch, it has ended up in serious trouble." | Monolith vs microservices vs modular |
| Ivory tower | Decisions made far from code | Fowler: Architectus Reloadus | Hands-on |
| Architecture astronauts | Abstractions for imagined needs | YAGNI | Last responsible moment |
| Accidental architecture | No one decided anything | Structure emerges from hacks | Name and record the top decisions |
| Distributed monolith | Services that must deploy together | See Service boundaries | Align boundaries to change and teams |
Step Month Event in a cargo-cult story (illustrative, inference) Result
1 1 0 "We need microservices" (no pain stated) No measurable goal
2 2 2 12 services, 4 developers Deploys need coordination
3 3 5 Shared database kept "for now" Distributed monolith
4 4 9 Incidents rise, features slow Merge services back, lose a yearFix / how to use it: for every big proposal ask: what problem do we have today, how will we measure that it is solved, what do we give up, and what is the smallest reversible first step?
Reading map of this path
All 21 chapters, in reading order. Chapters not yet written appear as planned in the path overview.
| # | Chapter | One line |
|---|---|---|
| 01 | This page | What architecture is, why it exists, what an architect does |
| 02 | 4+1 View Model | Five views of one system and the scenarios that tie them |
| 03 | Architecture Decisions | Trade-offs, ADRs, second-order effects, no perfect architecture |
| 04 | Requirements to Architecture | From stakeholder needs to quality scenarios and decisions |
| 05 | Capacity Estimation | Back-of-the-envelope traffic, storage, bandwidth |
| 06 | SLA, SLO, SLI, Error Budgets | Turning reliability into numbers and budgets |
| 07 | Styles vs Patterns | Which words mean what, and where each applies |
| 08 | Layered Monolith | Horizontal layers and their dependency rule |
| 09 | Modular Monolith | One deployable, enforced module boundaries |
| 10 | Microkernel / Plugin | A small core plus extensions |
| 11 | Client-Server | The variants from thin client to peer-to-peer |
| 12 | Pipe-and-Filter | Stages connected by streams |
| 13 | SOA | Services, buses and what went wrong |
| 14 | Microservices | Independent services and their costs |
| 15 | Big Data Architectures | 3Vs, batch vs stream, Lambda and Kappa |
| 16 | Monolith vs Microservices vs Modular | A decision framework |
| 17 | Service Boundaries | Teams, Conway's law, the distributed monolith |
| 18 | Service Communication | Sync vs async, contracts, retries, idempotency |
| 19 | Gateway, BFF, Mesh | Edge and cross-cutting infrastructure |
| 20 | Service Discovery | Finding instances: DNS, registries, health checks |
| 21 | Data Ownership | Database per service and brownfield options |
Neighbouring paths: Design (responsibilities inside a module), System Design (load and building blocks), Database and Messaging (the data and communication choices architecture depends on).
Mechanics
Deciding whether a decision is architectural Must-know
Ask four questions in order; two "yes" answers make it architectural and worth an ADR.
| Question | Yes means |
|---|---|
| Does it change structure (modules, services, data ownership)? | Structural |
| Does it change a top-three characteristic? | Characteristic-affecting |
| Is it expensive or slow to reverse (many callers, data, contracts)? | High reversal cost |
| Do several teams depend on it? | Cross-team |
Writing the dependency rule so a machine can check it Important
A rule must be (1) stated in one sentence, (2) mapped to code locations, (3) enforced in CI. Example: "orders must not import billing; the composition root may." The Go and Laravel sections do exactly that.
Where each rule is enforced
| Layer of enforcement | Go | PHP / Laravel |
|---|---|---|
| Compiler / language | internal/ packages; import cycles are compile errors | Namespaces and final classes only (no enforcement across namespaces) |
| Static analysis | go-arch-lint (.go-arch-lint.yml, "mayDependOn") | Deptrac (deptrac.yaml, layers and ruleset) |
| Unit-test style | go/parser imports test | Pest arch() expectations |
| Data | SQL query over pg_constraint | Same query in a migration test |
| Operational | Benchmark or load-test threshold | Pest + k6/Artillery threshold |
Error messages and signals you will see
| Where | Signal | Meaning |
|---|---|---|
| Go compiler | use of internal package ... not allowed | You crossed a module's hidden boundary |
| Go compiler | import cycle not allowed | Two packages depend on each other |
| archtest (this page) | ../internal/orders imports ...billing: violates ADR-0003 | The dependency rule was broken |
| go-arch-lint | A reported "component X shouldn't depend on Y" violation (exact wording depends on version, not verified) | Config says no |
| Deptrac | A violation list with the two layers and the file (exact wording not verified) | Ruleset says no |
| Laravel container | Target [App\Modules\Billing\Api\Billing] is not instantiable | Provider not registered in bootstrap/providers.php |
Go: architecture as code
The module is docs/snippets/architecture/what-is-software-architecture/go; gofmt, go vet and go test ./... pass. Layout:
Path Role
1 cmd/api/main.go Composition root: the only file that sees both modules
2 internal/orders/orders.go Module "orders": declares the Biller interface it needs
3 internal/billing/billing.go Module "billing": public surface
4 internal/billing/internal/ledger/ Hidden detail (Go internal rule)
5 archtest/arch_test.go Fitness functions
6 .go-arch-lint.yml Dependency rules for go-arch-lintExample
The two modules and the composition root:
// Package orders is one module. It declares the small interface it needs
// from billing (consumer-side), so it never imports the billing package.
package orders
import (
"context"
"fmt"
)
// Biller is what orders needs from whoever charges money.
type Biller interface {
Charge(ctx context.Context, customerID string, cents int64) error
}
// Order is the result of a successful placement.
type Order struct {
ID int64
CustomerID string
Cents int64
}
// Service places orders.
type Service struct {
biller Biller
nextID int64
}
// New builds the orders service around a Biller.
func New(b Biller) *Service {
return &Service{biller: b}
}
// Place charges the customer and returns the order.
func (s *Service) Place(ctx context.Context, customerID string, cents int64) (Order, error) {
if err := s.biller.Charge(ctx, customerID, cents); err != nil {
return Order{}, fmt.Errorf("place order: %w", err)
}
s.nextID++
return Order{ID: s.nextID, CustomerID: customerID, Cents: cents}, nil
}// Package billing is one module. Its public surface is this file only;
// everything else lives below internal/.
package billing
import (
"context"
"errors"
"academy/what-is-software-architecture/internal/billing/internal/ledger"
)
// ErrInvalidAmount is returned for zero or negative charges.
var ErrInvalidAmount = errors.New("billing: amount must be positive")
// Service charges customers.
type Service struct {
ledger *ledger.Ledger
}
// New builds a billing service with an empty ledger.
func New() *Service {
return &Service{ledger: &ledger.Ledger{}}
}
// Charge records a charge of cents for the customer.
func (s *Service) Charge(ctx context.Context, customerID string, cents int64) error {
if err := ctx.Err(); err != nil {
return err
}
if cents <= 0 {
return ErrInvalidAmount
}
s.ledger.Append(ledger.Entry{CustomerID: customerID, Cents: cents})
return nil
}
// Charges reports how many charges were recorded (useful in tests).
func (s *Service) Charges() int {
return s.ledger.Len()
}// Package ledger is a hidden detail of the billing module (Go "internal" rule).
package ledger
import "sync"
// Ledger is an append-only in-memory list of charges in integer cents.
type Ledger struct {
mu sync.Mutex
entries []Entry
}
// Entry is one charge.
type Entry struct {
CustomerID string
Cents int64
}
// Append records a charge.
func (l *Ledger) Append(e Entry) {
l.mu.Lock()
defer l.mu.Unlock()
l.entries = append(l.entries, e)
}
// Len returns the number of recorded charges.
func (l *Ledger) Len() int {
l.mu.Lock()
defer l.mu.Unlock()
return len(l.entries)
}// Command api is the composition root: the only place that knows both modules.
package main
import (
"context"
"fmt"
"os"
"academy/what-is-software-architecture/internal/billing"
"academy/what-is-software-architecture/internal/orders"
)
func main() {
bill := billing.New()
svc := orders.New(bill) // billing satisfies orders.Biller implicitly
o, err := svc.Place(context.Background(), "c-42", 1999)
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
fmt.Printf("order %d for %s: %d cents, %d charge(s) in ledger\n", o.ID, o.CustomerID, o.Cents, bill.Charges())
}The dependency rules as a linter config (go-arch-lint, schema version 3; reviewed against its README and syntax table, not executed here because the tool is not installed on the authoring machine):
# go-arch-lint config (schema version 3). Run from the module root:
# go install github.com/fe3dback/go-arch-lint@latest && go-arch-lint check
version: 3
workdir: internal
components:
orders: { in: orders }
billing: { in: billing }
deps:
orders:
mayDependOn: [] # orders must not import billing; it uses its own Biller interface
billing:
mayDependOn: [] # billing knows nothing about ordersThe fitness functions as tests: two structural (dependency rule, composition root) and one operational (latency budget):
// Package archtest holds fitness functions: automated checks that an
// architecture decision still holds. They run with plain `go test ./...`.
package archtest
import (
"context"
"go/parser"
"go/token"
"io/fs"
"path/filepath"
"sort"
"strings"
"testing"
"time"
"academy/what-is-software-architecture/internal/billing"
"academy/what-is-software-architecture/internal/orders"
)
const mod = "academy/what-is-software-architecture/"
// imports returns, per module directory under ../internal, the set of
// project import paths used by its non-test files.
func imports(t *testing.T, dir string) map[string]bool {
t.Helper()
set := map[string]bool{}
err := filepath.WalkDir(dir, func(p string, d fs.DirEntry, err error) error {
if err != nil || d.IsDir() || !strings.HasSuffix(p, ".go") || strings.HasSuffix(p, "_test.go") {
return err
}
f, err := parser.ParseFile(token.NewFileSet(), p, nil, parser.ImportsOnly)
if err != nil {
return err
}
for _, im := range f.Imports {
path := strings.Trim(im.Path.Value, `"`)
if strings.HasPrefix(path, mod) {
set[path] = true
}
}
return nil
})
if err != nil {
t.Fatal(err)
}
return set
}
// ADR-0003 (dependency rule): orders and billing must not import each other.
func TestModulesDoNotImportEachOther(t *testing.T) {
rules := map[string]string{
"../internal/orders": mod + "internal/billing",
"../internal/billing": mod + "internal/orders",
}
for dir, forbidden := range rules {
for imp := range imports(t, dir) {
if strings.HasPrefix(imp, forbidden) {
t.Errorf("%s imports %s: violates ADR-0003", dir, imp)
}
}
}
}
// ADR-0003: the composition root is the only place allowed to see every module.
func TestOnlyMainWiresModules(t *testing.T) {
var users []string
_ = filepath.WalkDir("..", func(p string, d fs.DirEntry, err error) error {
if err != nil || d.IsDir() || !strings.HasSuffix(p, ".go") || strings.HasSuffix(p, "_test.go") {
return err
}
f, perr := parser.ParseFile(token.NewFileSet(), p, nil, parser.ImportsOnly)
if perr != nil {
return perr
}
n := 0
for _, im := range f.Imports {
path := strings.Trim(im.Path.Value, `"`)
if path == mod+"internal/orders" || path == mod+"internal/billing" {
n++
}
}
if n == 2 {
users = append(users, filepath.ToSlash(p))
}
return nil
})
sort.Strings(users)
if len(users) != 1 || users[0] != "../cmd/api/main.go" {
t.Errorf("only cmd/api/main.go may import both modules, got %v", users)
}
}
// ADR-0004 (quality attribute, performance): placing an order in-process must
// stay far below the 50 ms budget we gave this step. The budget is generous so
// the test is stable; a real one would read p95 from load-test output.
func TestPlaceOrderLatencyBudget(t *testing.T) {
svc := orders.New(billing.New())
const n = 1000
durations := make([]time.Duration, 0, n)
for i := 0; i < n; i++ {
start := time.Now()
if _, err := svc.Place(context.Background(), "c-1", 100); err != nil {
t.Fatal(err)
}
durations = append(durations, time.Since(start))
}
sort.Slice(durations, func(i, j int) bool { return durations[i] < durations[j] })
p95 := durations[n*95/100]
if p95 > 50*time.Millisecond {
t.Errorf("p95 = %v, budget is 50ms (ADR-0004)", p95)
}
}The Go angle
| Go feature | Architectural use |
|---|---|
| Package as unit of import | Dependencies are explicit; the import graph is the structure |
internal/ | The compiler enforces hidden parts (Go 1.4); see go.dev/doc/modules/layout |
| Implicit interfaces | The consumer owns the interface (orders.Biller); no import of the provider |
cmd/<name> | One composition root per binary |
go/parser with ImportsOnly | Cheap, dependency-free architecture tests |
go list -deps, go vet | Extra checks, run in CI |
| go-arch-lint | Declarative rules over components, run in CI |
Laravel: architecture as code
The files are under docs/snippets/architecture/what-is-software-architecture/php (Laravel 13, PHP 8.4). PHP is not installed on the authoring machine; the code and configs were reviewed, not run.
Example
The public contract, the hidden internals, the service, the provider and the use case:
<?php
declare(strict_types=1);
namespace App\Modules\Billing\Api;
/**
* Public contract of the Billing module. Other modules may depend on this
* interface and nothing else inside App\Modules\Billing.
*/
interface Billing
{
/** @throws \InvalidArgumentException when $cents is not positive */
public function charge(string $customerId, int $cents): void;
}<?php
declare(strict_types=1);
namespace App\Modules\Billing\Internal;
use Illuminate\Support\Facades\DB;
/** Hidden detail: the module's own table. */
final class Ledger
{
public function append(string $customerId, int $cents): void
{
DB::table('billing_ledger')->insert([
'customer_id' => $customerId,
'cents' => $cents,
'created_at' => now(),
]);
}
}<?php
declare(strict_types=1);
namespace App\Modules\Billing;
use App\Modules\Billing\Api\Billing;
use App\Modules\Billing\Internal\Ledger;
use InvalidArgumentException;
final class BillingService implements Billing
{
public function __construct(private readonly Ledger $ledger)
{
}
public function charge(string $customerId, int $cents): void
{
if ($cents <= 0) {
throw new InvalidArgumentException('Amount must be positive.');
}
$this->ledger->append($customerId, $cents);
}
}<?php
declare(strict_types=1);
namespace App\Modules\Billing;
use App\Modules\Billing\Api\Billing;
use Illuminate\Support\ServiceProvider;
/** The module's only wiring. Register it in bootstrap/providers.php. */
final class BillingServiceProvider extends ServiceProvider
{
public function register(): void
{
$this->app->bind(Billing::class, BillingService::class);
}
}<?php
declare(strict_types=1);
namespace App\Modules\Orders;
use App\Modules\Billing\Api\Billing;
use Illuminate\Support\Facades\DB;
/** One use case, one class (an Action). Depends on Billing's contract only. */
final class PlaceOrder
{
public function __construct(private readonly Billing $billing)
{
}
public function handle(string $customerId, int $cents): int
{
return DB::transaction(function () use ($customerId, $cents): int {
$this->billing->charge($customerId, $cents);
return DB::table('orders')->insertGetId([
'customer_id' => $customerId,
'cents' => $cents,
'created_at' => now(),
]);
});
}
}The dependency rules, twice: as a Deptrac config and as Pest architecture tests (fitness functions):
# Deptrac config (reviewed against the Deptrac docs, not executed here).
# Run: composer require --dev qossmic/deptrac-shim && vendor/bin/deptrac analyse
deptrac:
paths:
- ./app
layers:
- name: OrdersModule
collectors:
- type: directory
value: app/Modules/Orders/.*
- name: BillingApi
collectors:
- type: directory
value: app/Modules/Billing/Api/.*
- name: BillingInternal
collectors:
- type: directory
value: app/Modules/Billing/(?!Api/).*
ruleset:
OrdersModule:
- BillingApi # Orders may use Billing's public contract only
BillingInternal:
- BillingApi # Billing's own code may implement its contract
BillingApi: []<?php
declare(strict_types=1);
// Pest architecture tests (fitness functions), run by `./vendor/bin/pest`.
arch('orders talks to billing through its contract only')
->expect('App\Modules\Orders')
->not->toUse('App\Modules\Billing\Internal');
arch('billing does not know orders')
->expect('App\Modules\Billing')
->not->toUse('App\Modules\Orders');
arch('billing internals stay inside billing')
->expect('App\Modules\Billing\Internal')
->toOnlyBeUsedIn('App\Modules\Billing');
arch('modules use strict types')
->expect('App\Modules')
->toUseStrictTypes();The Laravel angle
| Laravel / PHP feature | Architectural use |
|---|---|
Service provider, bootstrap/providers.php | One provider per module is its wiring (Laravel 13 provider docs) |
bind(Interface::class, Concrete::class) | Callers depend on the contract; the container supplies the implementation |
| Action classes | One use case per class, easy to guard |
DB::transaction | A modular monolith keeps atomicity across modules for free |
Pest arch() | not->toUse, toOnlyBeUsedIn, toUseStrictTypes (pestphp.com/docs/arch-testing) |
| Deptrac | Layers by directory or classLike collector, rules in ruleset |
| Events and queues | Asynchronous module boundaries (Event-Driven Architecture) |
Go and PHP differ in one detail: in Go the consumer owns the interface and never imports the provider, so the rule is "no import at all"; in PHP the provider publishes the Api namespace and the rule is "import Api only".
The data rule from the same decision, as a CI query (PostgreSQL); it must return zero rows:
-- Fitness function for data ownership: no foreign key between module schemas.
SELECT con.conname, src.relname AS from_table, dst.relname AS to_table
FROM pg_constraint con
JOIN pg_class src ON src.oid = con.conrelid
JOIN pg_class dst ON dst.oid = con.confrelid
WHERE con.contype = 'f' AND src.relnamespace <> dst.relnamespace;The longer, schema-named version lives in docs/snippets/architecture/what-is-software-architecture/php/fitness-cross-schema-fk.sql.
Solving the classic problems
Architecture that exists only in people's heads
| Solution | How | Advantage | Cost / limitation |
|---|---|---|---|
| C4 context and container diagrams in the repo | Maintained by the team | Shared picture | Diagrams drift without review |
| ADRs per significant decision | Nygard format | Reasons survive | Needs discipline |
| Architecture tests | go-arch-lint, deptrac, Pest arch() | Rules cannot silently rot | Only covers what you encode |
| Onboarding exercise | New hire redraws the system | Finds gaps | Time |
Boundary erosion
Symptom: "we are a modular monolith" but every module imports every other. Fix: write the dependency rule, run it in CI, allow exceptions only through an ADR. See Modular Monolith.
The architect becomes a bottleneck
| Solution | How | Cost |
|---|---|---|
| Advice process | Anyone decides after consulting affected people and the architect | Needs trust and ADRs |
| Principles, not approvals | A short list of principles teams apply themselves | Principles must be concrete |
| Automated compliance | Fitness functions replace review gates | Setup effort |
| Mentoring | Raise the team's level (Fowler: leverage comes from improving the team) | Slow payoff |
Decisions made too early or too late
Use the last responsible moment: list alternatives, list the date after which each is lost, decide at the latest date that still leaves time to learn. Record the trigger in the ADR.
Rewrite fever
Replace the rewrite with a sequence of small replacements behind a stable interface; measure after each. See Service Boundaries and Microservices Data Ownership for brownfield options.
Choosing: how much architecture, how early
| Situation | Recommended amount | Techniques | Reason |
|---|---|---|---|
| Prototype, throw-away | Almost none | Walking skeleton, one ADR on "this is disposable" | Learning beats structure |
| Startup product, one team | Light | Modular monolith, 3 characteristics, ADRs for data and auth | Keep change cheap |
| Growing product, several teams | Moderate | Module boundaries by team, fitness functions, contracts | Coordination cost dominates |
| Regulated or safety-critical | Heavy up front | ATAM, views (4+1), traceability | The cost of failure is high |
| Platform used by many teams | Strong governance, light enforcement | Principles, paved roads, automated checks | Consistency at scale |
| Legacy system | Evolutionary | Strangler, characterisation tests, fitness functions | Rewrites fail (see failure modes) |
In architecture: from a single process to a distributed system
Monolith: one process, one database
Everyday example: a small shop's web app in one Laravel project. The architecture decisions are few: one database, folders by feature, one queue. Write them as three ADRs and one context diagram. The dependency rule is simple (controllers do not query tables directly) and the characteristic that matters is modifiability. See Layered Monolith.
Production example: a Go API with cmd/api, internal/orders, internal/billing (this page's module) and the archtest in CI. A change in billing cannot break orders at compile time because the rule forbids the import.
Modular monolith and multiple databases
Modules own their code and their schema (PostgreSQL schemas orders, billing). The rule set grows: contract-only calls, no cross-schema foreign keys (the SQL fitness function above), a transaction boundary at the composition root. The architect's job shifts from drawing boxes to defining and automating the rules. See Modular Monolith.
| Decision | Choice | Guard |
|---|---|---|
| Boundary | Module per business capability | Deptrac / go-arch-lint |
| Data | Schema per module | No cross-schema foreign keys query |
| Communication | In-process contract; events for side effects | Pest arch() / import test |
| Deploy | One artifact | Single pipeline |
Microservices: boundaries with a network
When a module becomes a service, every in-process call becomes a network call with latency, partial failure and versioning. Architecture now has three more jobs: contract evolution, resilience policy (timeouts, retries, idempotency) and data ownership (Service Communication, Data Ownership). Fowler's Microservice Premium is the honest summary: you pay for deployment automation, monitoring, failure handling and eventual consistency. A multi-service example:
Step Caller Call Failure mode to design for
1 1 shop-web POST /orders (orders service) Timeout: retry only with Idempotency-Key
2 2 orders charge(customer, cents) (billing) Billing down: queue the charge or fail the order
3 3 billing publishes ChargeSucceeded (via outbox) Duplicate event: consumers must be idempotent
4 4 orders consumes event, marks order paid Event arrives late: UI shows "processing"Distributed data: replicas, caches and multi-region
Characteristics now compete across regions: consistency versus latency versus availability. Examples: a read replica gives read scale but replica lag breaks read-your-writes (Replication); a cache gives latency but stale reads; multi-region gives availability but cross-region coordination (Distributed SQL). Architecture's job is to decide per data set which trade-off applies, write it as an ADR, and test it (fitness functions on staleness, lag alerts).
Scaling path: 1x, 10x, 100x
| Load | Typical architecture | Main architectural risk | What to automate |
|---|---|---|---|
| 1x | Modular monolith, one PostgreSQL | Accidental coupling | Dependency rules |
| 10x | Same, plus read replicas, cache, queue | Stale reads, hot spots | Latency and lag budgets |
| 100x | Some services, partitioned data, async events | Distributed monolith, ownership confusion | Contract tests, SLO burn alerts |
Sizing the numbers is in Capacity Estimation; the system-level building blocks are in the System Design path.
Lab: add architecture as code to a project
Setup: use the Go module from this page (docs/snippets/architecture/what-is-software-architecture/go).
- Run the tests.
cdinto the module and rungo test ./.... Expected:ok academy/what-is-software-architecture/archtest. - Break the rule. In
internal/orders/orders.goadd the import"academy/what-is-software-architecture/internal/billing"and usebilling.New()somewhere. Rungo test ./archtest. Expected: a failure that names../internal/ordersand ADR-0003. - Break the composition-root rule. Add a second
main-like file that imports both modules (for example underinternal/orders/wire). Expected:TestOnlyMainWiresModulesreports two users. - Hit the language boundary. From
cmd/api/main.goimport.../internal/billing/internal/ledger. Expected: the compiler erroruse of internal package ... not allowed. - Add a characteristic. Add a benchmark or test that asserts p95 latency under 5 ms for
Place(tighten the budget inTestPlaceOrderLatencyBudget). Note the trade-off: a tight budget may fail on a loaded CI runner; write it into a new ADR-0004 as consequences. - Laravel (optional). Copy the PHP files into a Laravel 13 project, register
BillingServiceProviderinbootstrap/providers.php, install Pest and Deptrac, run./vendor/bin/pestandvendor/bin/deptrac. Expected: all pass; addinguse App\Modules\Billing\Internal\Ledger;toPlaceOrder.phpfails both. - Write one ADR for the rule you just enforced, with context, decision, consequences and a revisit trigger.
Common misconceptions
| Belief | Reality |
|---|---|
| Architecture is the diagram | A diagram is a view; the structures and decisions are the architecture |
| Architecture equals microservices | A modular monolith, layered monolith or pipeline are architectures too |
| The architect makes all important decisions | Fowler: value is inversely proportional to the number of decisions made; mentor and guide |
| Architects should not code | Hands-on contact keeps decisions grounded; do not become the bottleneck either |
| Agile means no up-front architecture | SAFe: balance emergent design with intentional architecture |
| More documentation means better architecture | Small ADRs and diagrams that are kept current beat large documents |
| There is a best architecture | First law: everything is a trade-off |
| Pick the technology first | Characteristics and constraints first; technology is infrastructure |
| A rewrite will fix it | Spolsky: a rewrite is the single worst strategic mistake; evolve instead |
| Compliance is a review meeting | Automate it with fitness functions |
| Quality attributes are optional extras | They decide the structure; features alone do not |
| The cloud provider is the architecture | It is infrastructure that constrains the architecture |
Cheat sheet
| Topic | Remember |
|---|---|
| Bass et al. | Structures: elements, relations, properties |
| ISO/IEC/IEEE 42010 | Fundamental concepts or properties of a system in its environment, embodied in elements, relationships, principles of design and evolution |
| Fowler / Johnson | Shared understanding of experts; the important stuff |
| Richards / Ford | Style, characteristics, logical components, decisions (and principles) |
| Why architecture | Change, communication, quality attributes, cost of reversal |
| Three scopes | Architecture shape, infrastructure ground, design rooms |
| First law | Everything is a trade-off; second: why over how; third: spectrum |
| Architect expectations | Decide, analyse, keep current, comply, diversify, domain, people, politics |
| Archetypes | Enterprise, solution, application, technical lead |
| Fowler's two architects | Reloadus decides all; Oryzus mentors and guides |
| Agile | Emergent plus intentional; runway; last responsible moment |
| Docs | Context + container diagrams (C4), views (4+1), ADRs |
| Evaluation | ATAM (days, early), fitness functions (every commit) |
| Evolutionary | Guided, incremental change as a first principle |
| Failure modes | Resume-driven, big-bang rewrite, cargo cult, ivory tower |
| Tools | go-arch-lint, internal/, go/parser tests; Deptrac, Pest arch() |
Self-check: questions & answers
- Must-know asked in almost every interview
- Important frequent; expected at senior level
- Good to know extra depth that sets you apart
1 — State the Bass, Clements and Kazman definition and one thing it leaves out compared with ISO 42010. Good to know
Answer
Answer: Structures of the system: software elements, their externally visible properties and the relationships among them. It does not mention the system's environment or the principles of design and evolution, which ISO 42010 includes. See Definitions.
2 — What did Ralph Johnson object to in "architecture is the fundamental organisation"? Good to know
Answer
Answer: There is no objective way to say what is fundamental or high-level; he preferred the shared understanding of the experts, and concluded "Architecture is about the important stuff. Whatever that is." See History.
3 — Give the four needs that make architecture exist. Must-know
Answer
Answer: Managing change, communication, quality attributes, and cost of reversal (plus coordination of teams). See Why.
4 — Is choosing Kubernetes an architectural decision? Must-know
Answer
Answer: It is mainly infrastructure; it becomes architectural to the extent it changes structure or a characteristic (deployability, elasticity). See Scopes.
5 — State the first law and one corollary. Important
Answer
Answer: Everything in software architecture is a trade-off; if you think you found something that is not, you have not found the trade-off yet (or: you cannot do the analysis only once). See Laws.
6 — Name Fowler's two kinds of architect and the rule of thumb about value. Important
Answer
Answer: Architectus Reloadus (makes all decisions) and Architectus Oryzus (collaborates, mentors). Value is inversely proportional to the number of decisions the architect makes. See Role.
7 — Why is Richards and Ford's "ensure compliance" best automated? Important
Answer
Answer: Manual governance makes architects police and teams avoid them; fitness functions check rules on every commit. See Evaluating.
8 — Define the last responsible moment and the architectural runway. Important
Answer
Answer: LRM: the moment at which failing to decide eliminates an important alternative. Runway: existing code, components and infrastructure needed to implement near-term features with minimal redesign and delay. See Agile.
9 — What does ATAM produce and when do you run it? Good to know
Answer
Answer: Findings about quality-attribute fit and trade-offs: risks, non-risks, sensitivity points, trade-off points; run it on a design before large commitments (three to four days with stakeholders). See Evaluating.
10 — In the Go module, why does orders declare Biller itself? Must-know
Answer
Answer: The consumer owns the interface, so orders never imports billing; only the composition root wires them. This is the rule the tests enforce. See Go.
11 — Name two ways the Laravel example enforces the module boundary. Important
Answer
Answer: Deptrac layers with a ruleset and Pest arch() expectations (not->toUse, toOnlyBeUsedIn). See Laravel.
12 — Why is a big-bang rewrite an architectural failure mode? Must-know
Answer
Answer: It throws away working knowledge and delivers nothing until the end; Spolsky calls it the single worst strategic mistake. Evolve in small guarded steps instead. See Failure modes.
Glossary
| Term | Meaning |
|---|---|
| Software architecture | Structures, characteristics, decisions and principles of a system, as understood by its builders |
| Structure | Elements and the relations between them |
| Element | A part of the system: module, service, database, component |
| Architecture characteristic | A non-functional property the architecture must support (also quality attribute, "-ility") |
| Quality attribute | SEI/ISO term for a measurable system quality |
| Architecture decision | A choice that shapes structure or characteristics |
| Design principle | A guideline that steers many decisions |
| ISO/IEC/IEEE 42010 | Standard for architecture description: stakeholders, concerns, viewpoints, views |
| Stakeholder | Anyone with a concern about the system |
| Architect | The person who worries about the important stuff and keeps it healthy |
| Enterprise architect | Architect for the whole organisation's landscape |
| Solution architect | Architect for one solution spanning several systems |
| Application architect | Architect for one application or product |
| Technical lead | Team-level design owner who also codes |
| Ivory-tower architect | One who decides at a distance from the code |
| Architectus Oryzus | Fowler's hands-on, collaborating architect (the guide) |
| Trade-off | A gain paid for with a loss elsewhere |
| ATAM | SEI's Architecture Tradeoff Analysis Method |
| Fitness function | Automated check that an architectural goal or rule still holds |
| Evolutionary architecture | Architecture supporting guided, incremental change |
| ADR | Architecture decision record |
| C4 model | Context, container, component, code diagrams (Simon Brown) |
| 4+1 views | Kruchten's five-view description model |
| Last responsible moment | The latest time a decision can be made without losing an important alternative |
| Architectural runway | Existing code and infrastructure that lets near-term features ship with minimal redesign |
| Emergent design | Structure that grows with code under tests |
| Intentional architecture | Deliberate, planned structural decisions |
| Resume-driven design | Choosing technology for the CV |
| Cargo cult | Copying visible form without the conditions that made it work |
| Distributed monolith | Services that must change and deploy together |
| Composition root | The one place where modules are wired together |
| go-arch-lint | Go linter that checks dependency rules from a YAML file |
| Deptrac | PHP static analyser that enforces layer dependency rules |
Pest arch() | Pest's architecture-testing API |
References
- Martin Fowler, Software Architecture Guide (Johnson quotes, "important stuff", why architecture matters); "Who Needs an Architect?", IEEE Software, 2003 (Architectus Reloadus and Oryzus, guide, "hard to change")
- Martin Fowler, "Microservice Premium"; "Monolith First", 3 June 2015; "Is Design Dead?"; "Yagni"; "Architecture Decision Record"
- Bass, Clements, Kazman, Software Architecture in Practice, 2nd ed., 2003: definition as published at the SEI definitions list (copy); the "set of structures" wording is from Documenting Software Architectures: Views and Beyond, seen only via secondary slides
- ISO/IEC/IEEE 42010: definition and commentary on iso-architecture.org
- Richards and Ford, Fundamentals of Software Architecture (O'Reilly); Thoughtworks book page; reader's chapter notes on the early-release second edition (secondary): Ted Neward's notes. The O'Reilly site denied automated access, so the book text itself was not read
- Ford, Parsons, Kua, Building Evolutionary Architectures: Thoughtworks book page; Thoughtworks, Fitness function-driven development
- Michael Nygard, Documenting Architecture Decisions, 15 November 2011
- SEI, Architecture Tradeoff Analysis Method collection
- Scaled Agile Framework, Architectural Runway
- Jeff Atwood, The Last Responsible Moment (quotes Poppendieck, Lean Software Development)
- Simon Brown, The C4 model
- Joel Spolsky, Things You Should Never Do, Part I, 6 April 2000
- go-arch-lint: README and syntax; Deptrac: README and collectors
- Go: Organizing a Go module; Laravel 13: Service Providers; Pest: Architecture testing