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.

By Vijay Mathew

Front Matter

  1. Preface
    PrefaceWhy this book exists, who it is for, and how to read it.

Part I — The Two Costs of Complexity

  1. Chapter 1
    Two Ways Software Gets HardConstraint versus flexibility as opposing responses to complexity; contracts as the hinge.
  2. Chapter 2
    Contracts as a Design ToolNex's require / ensure / invariant / variant — preconditions as specifications, not assertions.

Part II — Constraining the Core

  1. Chapter 3
    Making Illegal States UnrepresentableConstrained types, sum types, exhaustive match, invariants.
  2. Chapter 4
    Parse, Don't Validate: Boundaries and TrustTurning untrusted input into trustworthy types once, at the edge; why the interior never re-checks.
  3. Chapter 5
    Workflows as TransformationsA business process as a pipeline of total functions over precise types.
  4. Chapter 6
    Effects at the Edges, Purity at the CorePushing I/O, time, and failure to the boundary so the domain stays testable.

Part III — Composing Behavior

  1. Chapter 7
    Combinators: Building by CompositionClosed interfaces, snap-together parts, additive design.
  2. Chapter 8
    Layering: Behavior in StrataAdding capability without editing the base; the first taste of open, still fully typed.

Part IV — Opening the Frontier

  1. Chapter 9
    Generic Operations: Extending Without EditingThe first deliberate step outside the type system; contracts start doing the guarding.
  2. Chapter 10
    Languages for the Domain (DSLs)Giving the domain a vocabulary, made executable and open-ended.
  3. Chapter 11
    Evaluators You Can ExtendInterpreters whose own primitives grow at runtime.

Part V — Flexibility Under Partial Information

  1. Chapter 12
    Propagators: Computing with Partial KnowledgeMulti-directional, additive computation; a quoting engine where facts converge from many sources.
  2. Chapter 13
    Unification and SearchMatching and merging structures; fulfillment routing under constraints.

Part VI — Judgment

  1. Chapter 14
    Where to Draw the LineThe decision framework: signs a domain wants tightening, signs it wants opening.
  2. Chapter 15
    Capstone: One System, Both DisciplinesThe running example end to end — a tight order core with an extensible pricing engine at the edge.

Appendices

  1. Appendix A
    Reading NexA short orientation to the Nex constructs the listings use, for readers who know another typed language.
  2. Appendix B
    The Complete CapstoneThe whole running system in one listing, built bottom-up.
  3. Appendix C
    Sources & Further ReadingAn annotated guide to the works the book draws on, by thread.
  4. Appendix D
    GlossaryThe book's significant and coined vocabulary.