← Graph

Resource / Model / Table

concept 2 connections

Yippee's renamed take on the repository pattern. Distinct, clearly-contracted classes: **resource** (the entity presented to the HTTP request/response cycle), **model** (the entity presented to the application; immutable data representations), and **table** (a class that understands the schema of one persistent table). A **table** is the most common kind of **data source**; other data sources include dynamic ones (joins — a scoped cartesian product of two or three tables) and plain values. Layers collapse into an Active-Record-like one-file experience when mapping is 1:1:1, and expand cleanly when a resource maps to several tables or several models map to one table. Same basic concept as the repository pattern with minor tweaks — Stephen says he likes the idea but hates the original names.

category
architecture
about
Resource / Model / Table concept
Model layer section introduces the resource / model / table / data-source distinction as a renamed repository pattern.
concept Resource / Model / Table
related_to
The named layers exist precisely so they can be collapsed (1:1:1 Active-Record-style) or expanded (3 models for 1 table) as needed.

Provenance

Read by
1 extraction