"The project behind this post is intentionally a bit over-engineered - in the "let's see what breaks when things grow" sense. That's by design. While a simple recipe example could easily be modelled with plain strings and numbers, cookbook explores more advanced, real-world concerns: extensibility, customisation, validation, and precise handling of numeric values, including floating-point quantities. The recipe domain is just a familiar, low-stakes vehicle for discussing these deeper ideas."
"When we talk about JSON serialisation, we're often already deep in technical territory - codecs, encoders, decoders, property tests. But at its core, serialisation is a very human idea: taking structured information and translating it into a format everyone can understand. Long before APIs and databases, we were already doing this - just not in JSON. To explore this idea without jumping straight into abstractions, this post starts with something familiar: a recipe."
A deliberately over-engineered recipe domain models extensibility, customization, validation, and precise numeric handling, including floating-point quantities. Scala and Circe provide codecs, encoders, and decoders to convert rich domain types to JSON while preserving type safety and numeric precision. Strong domain modeling separates representation concerns and helps manage evolving requirements and customizations. Golden tests capture canonical JSON outputs to guard against regressions and ensure backward compatibility as schemas change. The approach emphasizes practical trade-offs: clear contracts, careful floating-point handling, and test-driven stability for APIs and data interchange. Validation logic enforces domain invariants and prevents subtle serialization errors from creeping into persisted or exchanged data.
Read at Medium
Unable to calculate read time
Collection
[
|
...
]