MVC: Model Layer

I think of the MVC model as an umbrella under which a whole other structure is required. It is the most critical layer of the MVC triad, and the layer that requires the most planning.

The Service Layer is the highest level layer of the model. It is the model’s interface to the outside word. Controllers call on it to complete complex tasks on behalf of users, and it coordinates the Domain objects and Data Mappers to carry out such tasks.

The Domain is a collection of classes that represent business objects. Class names are typically nouns such as 'user', 'customer' and 'product', and classes include both data and behaviour. Large and complex systems may benefit from a fully domain driven design approach, but smaller system may get by with just a few design rules.

Mapper classes translate between the object world and the RDBMS. There is often one Mapper class per Domain object, but this is certainly not always the case.