Search the web
Sign In
New User? Sign Up
altdotnet · Alt Dot.Net Discussions
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Want to share photos of your group with the world? Add a group photo to Flickr.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Sharing Value Objects between Domain and Application layers   Message List  
Reply | Forward Message #13140 of 23391 |
Hi,
 
I have a client-server app here. The domain model runs on the server, while the client uses the application layer without any awareness of the domain layer. That means that the the client and the server exchange DTO's defined in the application layer.
 
DTO's for entities are ok, because they are quite different from the entities themselves. But value objects and their DTO's are almost the same (especially enums). I'm thinking about a pragmatic approach where I don't have to copy the classes. I have three ways to go and each of them is flawed:
 
 - The idea of referencing the domain layer from the application layer and reusing domain value object classes looks wrong to me.
 - Referencing the application layer from the domain is even worse.
 - Splitting the domain layer into "values" and "entities" has the risk of the "values" part containing things not really needed to the domain layer.
 
Any thoughts are more than welcome.
 
Thanks,
Sergey


Fri Aug 8, 2008 8:15 am

shishkin_sergey
Offline Offline
Send Email Send Email

Forward
Message #13140 of 23391 |
Expand Messages Author Sort by Date

Hi, I have a client-server app here. The domain model runs on the server, while the client uses the application layer without any awareness of the domain...
Sergey Shishkin
shishkin_sergey
Offline Send Email
Aug 8, 2008
8:13 am

Personally I think it is wrong as your coupling your client application to the serverside objects. Which mean you always have to change both even when the...
Andrew Stewart
andrew.stewart@...
Send Email
Aug 8, 2008
8:33 am

Even with this model then your dtos become the bottleneck when it comes to changing them. There's always something you need to share between the client and the...
Simone Busoli
simone.busoli
Offline Send Email
Aug 8, 2008
8:48 am

For Example Lets take VAT(uk tax), in your domain object the calculation is: public decimal VAT { get { return Price * 17.5%; } } In your DTO it's just a...
Andrew Stewart
andrew.stewart@...
Send Email
Aug 8, 2008
8:56 am

I've been stuck with this way of sharing data a lot lately, since we have a service whose outputs vary quite often, and we try to limit spreading its output...
Simone Busoli
simone.busoli
Offline Send Email
Aug 8, 2008
9:05 am

Hi Simone Do you have an example? Cheers Andy ... -- ================= I-nnovate Software - Bespoke Software Development, uk wirral. http://www.i-nnovate.net...
Andrew Stewart
andrew.stewart@...
Send Email
Aug 8, 2008
9:17 am

Online store product page. Product data is supplied by a service and several clients consume it, the principal being the store web page. Data structure changes...
Simone Busoli
simone.busoli
Offline Send Email
Aug 8, 2008
9:27 am

Hmm The only thing I can think of is to return xml, then the clients can parse it however they want. Maybe something along the lines of all common data is ...
Andrew Stewart
andrew.stewart@...
Send Email
Aug 8, 2008
9:43 am

Exchanging xml is how it's been done until recently, and initially we thought that providing a strongly typed contract to the client would be a big step...
Simone Busoli
simone.busoli
Offline Send Email
Aug 8, 2008
1:39 pm

XML rarely makes a lot of sense as a way to work with data. It is great for storage and transfer of data, but it isn't nearly as nice to work with as objects....
Jesse Ezell
jesseezell
Offline Send Email
Aug 8, 2008
2:09 pm

Thank you guys for your time, but let us stop discussing the XML approach in this thread (feel free to fork with another subject). As I stated before, I don't...
shishkin_sergey
Offline Send Email
Aug 8, 2008
2:29 pm

Sorry for bringing the discussion out of topic, although the problem I described is exactly as I read in the title, sharing (value) objects between (onion ;) )...
Simone Busoli
simone.busoli
Offline Send Email
Aug 8, 2008
2:56 pm

Simone, my mistake was to mention the client in my question. Let's focus on the server: it has a domain layer and an application layer. Now the domain layer...
shishkin_sergey
Offline Send Email
Aug 8, 2008
5:29 pm

I'll post on this soon... But I personally don't like Enums too much. You can't attach behavior to them, so you wind up with stuff like this: switch...
Jimmy Bogard
jimmy.bogard
Offline Send Email
Aug 9, 2008
12:18 am

... behavior to ... treated ... Yeah I agree but they can be very useful, I end up quite often using an enum (presented to the outside world) and a type safe...
Colin Jack
colin.jack
Offline Send Email
Aug 9, 2008
2:06 pm

... I commonly start with a enum and then refactor to a class when I need to. Here's a simplified example. Original enum: enum Op { None, All, ... } Refactored...
Charlie Poole
cpoole98370
Offline Send Email
Aug 9, 2008
3:56 pm

I just described the same. I'm actually ok with sharing DTO's between the client and the server. The problem is yet on the server. I asked whether it is...
Sergey Shishkin
shishkin_sergey
Offline Send Email
Aug 8, 2008
12:43 pm

By exposing your domain layer, even with value objects, you still might be exposing behavior you didn't want to. Value objects are still a destination for...
Jimmy Bogard
jimmy.bogard
Offline Send Email
Aug 8, 2008
12:55 pm

What do you mean by enum classes? If I have, for example, an entity Patient which has an enum property Gender. Do you propose Gender to be a class instead of...
shishkin_sergey
Offline Send Email
Aug 8, 2008
1:41 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help