File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes When are business domain objects created? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "When are business domain objects created?" Watch "When are business domain objects created?" New topic
Author

When are business domain objects created?

Parag Doshi
Ranch Hand

Joined: Jun 29, 2004
Posts: 317
If I am not using entity beans to model my business objects and if I use a Fast Lane Reader to retrieve data , do I still create VO to be passed to the client layer?
In other words, when do we choose between creating a VO, say, FlightVO or creating the actual Flight domain object? I can understand that if you model your domain object as entity beans, then the entity bean's data is copied into a VO and that is passed across to the client. But, in the case, where I dont use an entity bean, then what is the value of creating a VO instead of the domain object? Yeah, the domain object would now have to be serialized as it will cross JVM boundaries, but, is there any other advantage to creating VO instead of domain objects as carriers of data to the client tier?

Parag
Tomi Tuomainen
Ranch Hand

Joined: Jun 13, 2004
Posts: 86
Parag,

The way I see it, domain object is purely conceptual, "analysis object model". The domain object might be implemented as an entity bean or it might correspond to VO created by DAO. I would just model VO's and EJB's the way it seems best for J2EE architecture and check later traceability. (This is probably not preferred way in any method, but the point is that don't model "domain objects" in diagrams after business analysis -> model design or implementation objects).

Tomi
Louise Elliott
Greenhorn

Joined: Aug 02, 2004
Posts: 11
Parag,

If you are using a DAO with your Fast Lane Reader then you would normally create a VO. You could just use your domain object but the convention with DAO is to refer to a VO and so if you want people to understand your meaning with the least effort it seems to make sense to refer to a VO.

Louise.
Parag Doshi
Ranch Hand

Joined: Jun 29, 2004
Posts: 317
Originally posted by Louise Elliott:
Parag,

If you are using a DAO with your Fast Lane Reader then you would normally create a VO. You could just use your domain object but the convention with DAO is to refer to a VO and so if you want people to understand your meaning with the least effort it seems to make sense to refer to a VO.

Louise.


Thanks Louise. That makes sense.
Parag Doshi
Ranch Hand

Joined: Jun 29, 2004
Posts: 317
Tomi,
What does this mean?


(This is probably not preferred way in any method, but the point is that don't model "domain objects" in diagrams after business analysis -> model design or implementation objects).



Thanks,
Parag
Tomi Tuomainen
Ranch Hand

Joined: Jun 13, 2004
Posts: 86
Parag,

That means we should identify design classes based on domain classes (or objects). So I don't think any method (RUP etc.) recommends drawing implementation specific classes "blindly". Anyway, it's important that there's some kind of link between implementation specific elements (in component and sequence diagrams) and implementation independent elements (in class diagram). But we don't have to use same classes in all diagrams since perspective changes.

I hope I'm making some sense here... (feel free to correct if I'm not).

Tomi
Frank Silbermann
Ranch Hand

Joined: Jun 06, 2002
Posts: 1387
Whether you need to create an pass a value object that is distinct from your serializable non-EJB domain objects depends, I suppose, on whether your domain objects contain behavior that doesn't work outside the EJB server context. If your domain objects contain methods that access the DAO objects, those methods won't run in the client/presentation tier.

On the other hand, if your domain store (DAO) objects create and persist domain objects, but the domain objects remain ignorant of the DAO objects, (e.g., if domain object relationships were implemented by session beans that knew about both domain and DAO objects), then your domain objects would serve perfectly well as data transfer (i.e. value) objects.
Parag Doshi
Ranch Hand

Joined: Jun 29, 2004
Posts: 317
Frank, Tomi, thanks for your input.

I came across a scenario where my VO had to be more "intelligent" than just being a data carrier and the business intelligence it required was independent of the tier in which it executed, so was leaning more towards a domain object, but I also agree that the "norm" is that DAOs generally return VO and its less explaining to do than domain objects.

I think I might just use the VO and abstract that business logic computation in another class rather than going thru the troubles of justifying and explaining the usage of domain objects.


Parag
Anil Vupputuri
Ranch Hand

Joined: Oct 31, 2000
Posts: 527
But Fast Lane reader pattern may access Stale data bcoz it just gets what's in database and non-transactional reads are often possible since it doesn't use any EJB's.

As per assignment, its possible that Segment, Seat information can change quiet frequently. So 'Value List Handler' pattern makes more reasonable to me, it can pass the information to client through Transfer Objects.

Any comments?


SCJP 1.5, SCEA, ICED (287,484,486)
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
Anil,

Why are you shying away from using EJBs to handle these entities that can change frequently?


Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
Anil Vupputuri
Ranch Hand

Joined: Oct 31, 2000
Posts: 527
Yes Ajith, you're right. Just want to clarify....thats all.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: When are business domain objects created?