Designing an access layer for shelve
Here's how shelve
might be used by an application. We'll look at parts of an application that edits and saves microblog posts. We'll break the application into two tiers: the application tier and the data tier. Within an application tier, we'll distinguish between two layers:
Application processing: These objects are not persistent. These classes will embody the behavior of the application as a whole. These classes respond to the user selection of commands, menu items, buttons, and other processing elements.
Problem domain data model: These are the objects that will get written to a shelf. These objects embody the state of the application as a whole.
The definitions of blog and post shown previously have no formal association between blog and its collection of posts. The classes are independent so that we can process them separately on the shelf. We don't want to create a single, large container object by turning Blog
into a collection class.
Within the...