I was involved in an interesting debate about the visibility of domain models & was wondering if people here have any good guidance.
Hope to see some comments & thoughts about this.
Appreciate all the help!
No, that isn't what MDA is about. It's about insulating oneself from specific platforms, using a higher level notation (UML and its action language) to specify the behaviour of the system.
Whether you should expose your domain model depends on the application. For users who use the application regularly (think about your IDE), then the domain model is clearly exposed, and you manipulate the objects in that domain directly. But for an app used occasionally (think about a kiosk at an airport for check-in) then the app should guide the user through the workflow.
Even if you are going to shield the domain objects, DTOs aren't necessarily necessary; it depends on whether the domain objects are in the same process space as the layer that renders the UI. Architectures that require DTOs aren't very good at adapting to new requirements, because they violate the DRY principle.
It is, in fact, possible to build enterprise apps solely out of directly exposed domain objects; this is the objective of the Naked Objects pattern. There are several open source frameworks that implement this, including the original, Naked Objects Framework (on Java). There's also an commercial equivalent for .NET.
For more discussion in general on domain objects, I recommend you check out Evans' book, Domain-Driven Design. There's also an active newsgroup up on yahoo.
Dan
full disclosure: I'm a committer to the NOF for Java, not directly involved in the .NET version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With