liveBook · Manning

First-class object

As explained in Data-Oriented Programming: Reduce software complexity

A first-class citizen is a value or language entity that can be represented, stored, passed, and manipulated in the same general ways as other values.

A first-class object is a value or language entity that can be represented, stored, passed, and manipulated like other values. Data-oriented programming applies this idea to data and fields, using generic collections and functions instead of requiring concrete types. section 15.3 section 10.5

The practical payoff is reproducibility: capture a function’s data arguments, copy them into a console, and improve or test behavior without triggering the original endpoint. section 15.3

Reproducing a book search

Capture catalogData and query from Catalog.searchBooksByTitle, recreate the call in a REPL, then test 'Habit'. The captured catalog data remains ordinary data that can be inspected and reused while the search implementation changes.

How Data-Oriented Programming: Reduce software complexity covers it

How deep it goes
Defines the idea through data collections, fields, late binding, and a worked REPL reproduction, without formal language-runtime internals.
Examples
Demonstrates captured catalog data, reproduced book-search calls, and a failing then improved 'Habit' query.
What it assumes
Assumes familiarity with functions, strings, nested maps, and database data, while demonstrating first-class treatment through concrete search examples.
What you can do after
Diagnose/debug with it by capturing data arguments, reproducing calls in a REPL, and iterating against concrete database data.
How it connects
Connects first-class data with generic functions, late binding, hash maps, database queries, and data-oriented programming.

Also explained in

Compare how 7 books explain first-class object →

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.