• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Where Should Domain Layer Fit in a 5-Layer Architecture?

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Two approaches from different gurus on the subject:
Floyd Marinescu
Presentation -> Application -> Services -> Domain -> Persistence
Eric Evans
Presentation -> Application -> Domain -> Infrastructure (Services & Persistence)
You can see here that Marinescu says Domain should be "underneath" Services, whereas Evans believes Domain should be above Services. I personally prefer Marinescu's scheme where the Services contains the knowledge of 1) how to persist a Domain object, 2) how to integrate persistence operations with other systems (ie sending async messages). However, isn't the following representation more consistent with Marinescu's layering?:
<---- Domain ---->
Presentation -> Application -> Services -> Persistence
The Domain layer is used across all layers and contains data and business logic/behavior. For example, it knows nothing about databases, messaging, or JNDI lookups. I do not like Evans' approache because his Domain objects contain a little persistence logic (e.g. "commit()" methods in Domain objects).
Any thoughts?
Patrick J. Nolan, Jr.
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It seems to me as if Floyd and Eric actually mean quite different things when they talk about "services". Do you have any links?
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yah, I think that's the disconnect.
http://www.ratio.co.uk/architectural_reference_model.pdf is a nice paper on archtitectural layering that I think references the disagreement about the order of some layers. They have some neat papers on use cases, too.
http://www.surfscranton.com/architecture/ArchitecturalLayering.htm is a short page I did on the topic with some pictures based on the above.
There are MANY ways to break down layers. Most of them are useful at one time or another even on the same system.
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Patrick Nolan:

The Domain layer is used across all layers and contains data and business logic/behavior.
Any thoughts?
Patrick J. Nolan, Jr.


Figure 15. in this doc seem to support your argument.
http://www-106.ibm.com/developerworks/rational/library/content/03July/2000/2169/2169.pdf
 
Stan James
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I'd dispute "domain is used across all layers". Each layer should be nicely isolated, and should be "used by" only the layer immediately above (or below depending on how you like your dependencies.) Frameworks have exceptions, like a Logger that is used everywhere, but the domain layer should not have any exceptions.
I took "figure 15" (and the paragraphs immediately above) to mean that given a particular domain model you could build a service-style interface or a component-style interface or both. Definitions of service and component can be debated ... Fowler suggests that they are very similar but components are used within a system and services are exposed to external and/or remote clients.
I guessed that when Evans put "services & persistance" below the domain layer, he meant OS services like the system clock and the file system. Something entirely different.
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is currently an interesting discussion going on about dependencies between layers at http://www.artima.com/forums/flat.jsp?forum=106&thread=35139
 
author
Posts: 608
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A high-level discussion is presented at http://www.ronin-intl.com/publications/classTypeArchitecture.htm.
- Scott
 
Time flies like an arrow. Fruit flies like a banana. Steve flies like a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic