This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes OO, Patterns, UML and Refactoring and the fly likes Implementing Patterns Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Implementing Patterns" Watch "Implementing Patterns" New topic
Author

Implementing Patterns

john milr
Greenhorn

Joined: May 31, 2006
Posts: 18
Hi! I am developing a struts based application.

I don't want to use EJB.
Using JDBC for connection. Using Connection Pooling.

For separating the business tier from the view tier, using an External Interface(BusinessDeligate class).
For all services, using ServiceImplementer classes. Saparating the data access using DAO.
BO to loosely couple the business objects.
ServiceImplementer classes can access BOs & DAOs.
We use DTO to separate view layer from business layer.

My question is:

Where to create the DTO & which classes mentioned above can access DTO?
Where to put the state of BO in to DTO?
Can we access the DTO in Jsp?

DTO - Data Transfer Object.
BO - Business Object.
DAO - Data Access Object.
DTO - Data Transfer Object.
Business Deligate - Service Facade.
Service Implementer - Application Service.

Please help!!
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
First, take a look at http://martinfowler.com/bliki/LocalDTO.html to decide whether you really should use DTOs at all.


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
john milr
Greenhorn

Joined: May 31, 2006
Posts: 18
Thanks Ilja!!

I think I have few reasons:

1) To separate the business layer & presentation layer.
2) Client should not interact directly with the components in Business tier & Integration tier.
3) Later on I want to implement ORM. Then I can use the BOs.
4) DTO can aggregate data from DAOs, Application Service & BOs.
5) I have no idea but I may need to update & upgrade my application more frequently, and perhaps need to implement load balancing & clustering.

I really need some guidance.
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
The data transfer objects would be created by the business objects. These objects are used by the presentation-oriented code (GUI) to display data.

Whatever has to be stored in the data transfer object is stored in variables of the DTO.

Yes, you can certainly access the data transfer objects in a Java Server page.





john milr
Greenhorn

Joined: May 31, 2006
Posts: 18
Thank you! James.

I have still some doubts:

In my view the ServiceImplementer classes should access DAOs & BOs.
By using those it should generate response, & the response is sent to Action & Jsp, using DTOs.
It means, it is ServiceImplementer classes which generate DTOs.

BOs should be implemented with the concept of loose coupling & tight cohesion.
Jimmy Clark
Ranch Hand

Joined: Apr 16, 2008
Posts: 2187
It means, it is ServiceImplementer classes which generate DTOs.


If this object is creating data, then it should certainly create the data transfer objects.

If the business objects create data, then they should create the data transfer objects.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Implementing Patterns
 
Similar Threads
Tutorial - J2EE for Beginners
struts DAO layer and DTO objects
Design issue (POJO and DTO/VO)
Struts and App Design question
struts DAO layer and DTO objects