Architecture and design
Introduzido
Vocabulário
| English | Significado |
|---|---|
| layers/ˈleɪəz/ | layers |
| dependency rule | dependency rule |
| coupling | coupling |
| cohesion/kəʊˈhiːʒn/ | cohesion |
English
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}
Prática
The dependency rule points —
Dificuldade 1/5 · Moedas 100 + pequeno bônus na primeira conclusão hoje
Domain purity is what makes it testable without browser or database.
English
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}
Prática
The loan-rule change touches 1 module, 2 files. The smeared version touches —
Dificuldade 1/5 · Moedas 100 + pequeno bônus na primeira conclusão hoje
3 layers, 5 files: the count IS the coupling metric.
English
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}
Prática
Swapping the Notifier strategy costs —
Dificuldade 1/5 · Moedas 100 + pequeno bônus na primeira conclusão hoje
Behind an interface: the boundary buys the swap.