Architecture and design
Introduit| English | Sens |
|---|---|
| layers/ˈleɪəz/ | Software levels separating concerns such as presentation, domain logic and storage. |
| dependency rule | In clean architecture, the rule that source-code dependencies point toward inner policies rather than outer mechanisms. |
| coupling | The degree of dependency between software components. |
| cohesion/kəʊˈhiːʒn/ | How closely related the responsibilities within a software component are. |
Layers pointing inward
- BookShare in three layers: presentation (web app), domain (loans, members, catalog), storage (database). The dependency rule: dependencies point inward — the domain knows no framework, and that is what makes it testable.

{exercise:uni-cs1202-layers}
The dependency rule points —
Difficulté 1/5 · 100 pièces + un petit bonus lors de la première réussite aujourd'hui
Domain purity is what makes it testable without browser or database.
Coupling and cohesion, counted
- Cohesion keeps related change in one module; coupling spreads it. The loan-limit rule change: 1 module, 2 files (high cohesion, low coupling). The same rule smeared across presentation: 3 layers, 5 files. The count IS the design metric.
- The borrow sequence: presentation calls
domain.borrow(member, copy); the domain checks limit and status; storage records with dates; presentation confirms — four participants, five labelled messages.
{exercise:uni-cs1202-counting}
The loan-rule change touches 1 module, 2 files. The smeared version touches —
Difficulté 1/5 · 100 pièces + un petit bonus lors de la première réussite aujourd'hui
3 layers, 5 files: the count IS the coupling metric.
The boundary payoff
- Reminder delivery is a strategy behind a
Notifierinterface: email today, push tomorrow — swapping costs one configuration line, zero domain edits. - The domain importing the web framework inverts the rule and becomes untestable; diagrams as decoration (unlabelled arrows) review nothing.
{exercise:uni-cs1202-boundary}
Swapping the Notifier strategy costs —
Difficulté 1/5 · 100 pièces + un petit bonus lors de la première réussite aujourd'hui
Behind an interface: the boundary buys the swap.