This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Implementing Patterns

 
john milr
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, take a look at http://martinfowler.com/bliki/LocalDTO.html to decide whether you really should use DTOs at all.
 
john milr
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic