liveBook · Manning

Tuple

As explained in Data-Oriented Programming: Reduce software complexity

A tuple is a fixed-size ordered collection whose elements may have different types or shapes.

A tuple is a fixed-size, ordered array whose elements may have different types or shapes. Unlike a homogeneous array, each position has its own schema. section 12.1

Function arguments as a tuple

Represent the arguments to Catalog.searchBooksByTitle as a two-element tuple: the first element is catalog data and the second is a string query. Validate the tuple at development time, after boundary validation has already protected production inputs. section 12.1

How Data-Oriented Programming: Reduce software complexity covers it

How deep it goes
Defines positional heterogeneous arrays and demonstrates prefixItems, but does not detail broader tuple constraints.
Examples
Demonstrates string-number tuples and catalog-plus-query arguments for book searching.
What you can do after
Apply tuples via JSON Schema to validate fixed-position function arguments during development.
How it connects
Connects tuples with arrays, JSON Schema, function arguments, and data validation.

Also explained in

Compare how 15 books explain tuple →

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.