Introducing the Domain layer pattern
The following is Martin Fowler’s definition of the Domain layer (http://martinfowler.com/eaaCatalog/domainModel.html):
“An object model of the domain that incorporates both behavior and data.”
Like the Service layer, this pattern adds a further layer of separation of concerns and factoring of the application code, which helps to manage and scale a code base as it grows.
“At its worst business logic can be very complex. Rules and logic describe many different cases and slants of behavior, and it’s this complexity that objects were designed to work with. A Domain Model creates a web of interconnected objects, where each object represents some meaningful individual, whether as large as a corporation or as small as a single line on an order form.”
Martin’s reference to objects in the preceding quote is mainly aimed at objects created from instantiating classes...