liveBook · Manning

Universally unique identifier

As explained in Data-Oriented Programming: Reduce software complexity

A UUID is a 128-bit identifier represented in a standardized textual form and designed for practical global uniqueness.

A UUID gives captured test data a practical globally unique name, preventing one file from overwriting another when repeated runs produce many artifacts. section 15.4

Use a UUID when:

  • A filename combines stable context, such as a function name, with a generated identifier. section 15.4
  • Captured JSON must be written asynchronously so diagnostic storage does not slow the real work. section 15.4
  • Tests need to read previously captured inputs from files and reproduce a failing case. section 15.4

A captured search context

A search operation can store its catalog data and query under a path such as test-data/searchBooksByTitle-68e57c85-2213-471a-8442-c4516e83d786.json. The context remains recognizable, while the UUID makes the artifact distinct. section 15.4

Listing 15.18 Console output when triggering the search endpoint
Data for searchBooksByTitle stored in
test-data/searchBooksByTitle-68e57c85-2213-471a-8442-c4516e83d786.json

See the generated UUID embedded in the logged path for captured search data. section 15.4

How Data-Oriented Programming: Reduce software complexity covers it

How deep it goes
Defines UUID-based naming and library choices, but stops short of explaining UUID generation internals or collision probabilities.
Examples
Demonstrates UUIDs in captured search data paths and replayable JSON fixtures.
What it assumes
Assumes familiarity with unit tests, files, JSON, and language libraries while explaining the naming problem from its practical cause.
What you can do after
Apply it via a UUID library to generate distinct filenames for captured test data.
How it connects
Connects UUIDs with unit testing, JSON serialization, file paths, asynchronous file writing, and third-party libraries.

Also explained in

Compare how 10 books explain universally unique identifier →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Data-Oriented Programming: Reduce software complexity. The section links point to the parts of the book it draws on.