Pattern: Narrow Views

 

Abstract

To apply NarrowViews means accessing only those fields in a database that are really needed for a use case.

Context

For an order processing system you want to design a dialog box to select orders by customer and to view them. You have already defined a Physical View for orders and as you have use cases that process more than one order at a time, you have implemented a readMultiple() method that delivers a set of orders for a given customer.

 

Problem

What kind of views should you use for filling list boxes?

Forces

Solution

Use narrow views. Views for list boxes should contain the data needed in the list box and the primary key to access the object that you intend to select from the list box.

Consequences

Related Patterns

For reasons of clarity we have factored out the second rule for list boxes in the ShortViews pattern.