Software Design in Nex
Tight Core, Open Edge
Designing software that's both correct and flexible — constrain the core, open the edges, and let contracts be the membrane between them.
Front Matter
- PrefacePrefaceWhy this book exists, who it is for, and how to read it.
Part I — The Two Costs of Complexity
- Chapter 1Two Ways Software Gets HardConstraint versus flexibility as opposing responses to complexity; contracts as the hinge.
- Chapter 2Contracts as a Design ToolNex's
require/ensure/invariant/variant— preconditions as specifications, not assertions.
Part II — Constraining the Core
- Chapter 3Making Illegal States UnrepresentableConstrained types, sum types, exhaustive
match, invariants. - Chapter 4Parse, Don't Validate: Boundaries and TrustTurning untrusted input into trustworthy types once, at the edge; why the interior never re-checks.
- Chapter 5Workflows as TransformationsA business process as a pipeline of total functions over precise types.
- Chapter 6Effects at the Edges, Purity at the CorePushing I/O, time, and failure to the boundary so the domain stays testable.
Part III — Composing Behavior
- Chapter 7Combinators: Building by CompositionClosed interfaces, snap-together parts, additive design.
- Chapter 8Layering: Behavior in StrataAdding capability without editing the base; the first taste of open, still fully typed.
Part IV — Opening the Frontier
- Chapter 9Generic Operations: Extending Without EditingThe first deliberate step outside the type system; contracts start doing the guarding.
- Chapter 10Languages for the Domain (DSLs)Giving the domain a vocabulary, made executable and open-ended.
- Chapter 11Evaluators You Can ExtendInterpreters whose own primitives grow at runtime.
Part V — Flexibility Under Partial Information
- Chapter 12Propagators: Computing with Partial KnowledgeMulti-directional, additive computation; a quoting engine where facts converge from many sources.
- Chapter 13Unification and SearchMatching and merging structures; fulfillment routing under constraints.
Part VI — Judgment
- Chapter 14Where to Draw the LineThe decision framework: signs a domain wants tightening, signs it wants opening.
- Chapter 15Capstone: One System, Both DisciplinesThe running example end to end — a tight order core with an extensible pricing engine at the edge.
Appendices
- Appendix AReading NexA short orientation to the Nex constructs the listings use, for readers who know another typed language.
- Appendix BThe Complete CapstoneThe whole running system in one listing, built bottom-up.
- Appendix CSources & Further ReadingAn annotated guide to the works the book draws on, by thread.
- Appendix DGlossaryThe book's significant and coined vocabulary.