FOR TEAMS MAINTAINING ESTABLISHED SYSTEMS
Nobody wants to touch the pricing logic. And everyone has to, eventually.
Twelve years old, three authors, zero comments. FACET helps you write down, piece by piece, what an area really does — where the next change is due anyway, not as a documentation project for the whole monolith.
DOMAIN
- checkout
- inventorynot yet described
- shippingnot yet described
- accountsnot yet described
CAPABILITY
- pricing
- cartnot yet described
- paymentnot yet described
FEATURE
- tax-rate-by-country2 scenarios
- roundingnot yet described
The id that results: checkout/pricing/tax-rate-by-country
Illustrative example · one area, not the whole monolith
A WAY IN
Not the whole monolith. Just the part you touch next week.
Nobody has to describe everything first. You start where the next change is a headache anyway: one question, its answer, the code it is about and the test behind it.
Which tax rate applies when the country changes?
id: checkout/pricing/tax-rate-by-countrycontract: scenarios: - id: country-change-uses-destination-rate given: a cart priced for DE when: the shipping country changes to AT then: the AT rate applies to every line
// @facet: checkout/pricing/tax-rate-by-country// @facet-role: primaryfunc RateFor(country string) Rate { … }
// @facet: checkout/pricing/tax-rate-by-country// @facet-proves: country-change-uses-destination-ratefunc TestCountryChangeUsesDestinationRate(t *testing.T) { … }
Illustrative example · rule, code and test carry the same feature id
WHAT STAYS
Days of digging today. Just looking it up next time.
The next person finds why the pricing logic works this way, right next to the code. Especially valuable when a system’s history lives in only two or three heads.
docs/facets/ taxonomy.yaml features/ checkout/ pricing/ tax-rate-by-country.yamlsrc/pricing/ tax.go @facet: checkout/pricing/tax-rate-by-country tax_test.go @facet: checkout/pricing/tax-rate-by-country @facet-proves: country-change-uses-destination-rate
Illustrative example · facet lint checks records against their schema and against the code they anchor, after the next change too
WHAT FACET DOES NOT DO HERE
One area. A bounded experiment.
FACET cannot reconstruct unknown intent. Open business questions still need people.