Row data gateway pattern

From CSSEMediaWiki
Jump to: navigation, search

An object that acts as a Gateway to a single record in a data source. There is one instance per row.

How it works

Each row in the table is represented as one object. That object has exactly the same fields as the database row, and all the methods to update itself in the database. There is a Finder class which instantiates the object.

When to use it

If you require a slightly higher level of abstraction than the simple Table data gateway pattern, then use it. Fowler uses it most often when using the Transaction script pattern.

Example

Row-data.png

Personal tools