liveBook · Manning

Record type

As explained in Building User-Friendly DSLs

A construct representing a named record with a collection of attributes in the domain-specific language.

A record type defines the shape of a named domain record without storing the Runtime data itself. A Rental record type, for example, specifies data for an intended car rental; Runtime representations may include database tables, execution classes, or UI forms. section 1.2.1

Figure 1.10 Origin of the referenced rental period: the Rental record type
figure

The Rental definition anchors referenced business data in a named record type and its attributes. section 1.2.1

A record type organizes related data through properties:

  • Its name identifies the kind of record, such as Rental. section 1.4.2
  • Its attributes property holds attribute instances; each attribute has a human-readable name, a type, and optionally an initial value. section 1.2.1 section 1.4.2
  • Attribute types control stored values and their Runtime presentation and processing; illustrated types include date ranges, dollar amounts, and percentages. section 1.2.1
  • A record type can later hold zero or more attached business rules through a business rules property. section 14.1.1

In the AST, a record type is an object whose settings include name and attributes. Relations are represented through settings: the attributes setting contains attribute objects rather than isolated data values. section 1.4.2

Projecting Rental

Render a Record Type AST object by displaying its name and mapping its attributes array to Projection calls. Begin with an HTML mockup, apply CSS for readable notation, then replace fixed content with JSX expressions derived from settings. section 4.2.1 section 4.2

To attach business rules, migrate existing Record Type objects so business rules is an array, project that array, and add new Business Rule objects through the record type interface. section 14.1.1

How Building User-Friendly DSLs covers it

How deep it goes
Explains record type properties and AST projection, then extends the concept with editable business rules.
Examples
Uses a Rental record type with attributes and renders it through HTML, CSS, and JSX Projection code.
What it assumes
Introduces record types as DSL concepts while relying on AST objects, JSX, CSS, and array mapping for implementation.
What you can do after
Build it from scratch by modeling record type settings, projecting attributes, and adding a business-rules collection.
How it connects
Connects record types with attributes, AST objects, settings, business rules, and projections.

Also explained in

Compare how 2 books explain record type →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Building User-Friendly DSLs. The section links point to the parts of the book it draws on.