Late binding defers decisions about concrete data types until they are actually needed. A database result can travel through generic collections without every step knowing whether a value is a string, integer, or another type. section 10.1
A practical question is: where must the type finally matter? In a book search, values can pass through lists of maps unchanged; the JSON serialization library handles concrete representation at the boundary. section 10.1
Database results as data
A JDBC result set becomes a list of hash maps by reading each column label and storing each value as Object. Search results can then be validated against a JSON schema and serialized as JSON. The design avoids casting during intermediate data manipulation, while preserving validation where the result crosses an external boundary.
Late binding makes data-oriented manipulation flexible:
- Represent database rows as generic collections rather than instances of entity classes. section 10.5
- Treat field names as strings, allowing generic functions to rename keys, group rows, or access values. section 10.5
Lodash functions introduced in this chapter
| Creates a map composed of keys generated from the results of running each element of coll through f. The corresponding value for each key is an array of elements responsible for generating the key. |
Generic collection functions show how late-bound maps support reusable operations across different data entities. section 10.5
