Architecture and design
แนะนำใหม่
คำศัพท์
| English | ความหมาย |
|---|---|
| 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. |
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}
ฝึกฝน
The dependency rule points —
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
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}
ฝึกฝน
The loan-rule change touches 1 module, 2 files. The smeared version touches —
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
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}
ฝึกฝน
Swapping the Notifier strategy costs —
ความยาก 1/5 · 100 เหรียญ + บอนัสน้อยๆ เมื่อทำสำเร็จครั้งแรกในวันนี้
Behind an interface: the boundary buys the swap.