This week's book giveaways are in the Jython/Python and Object-Oriented programming forums.
We're giving away four copies each of Machine Learning for Business: Using Amazon SageMaker and Jupyter and Object Design Style Guide and have the authors on-line!
See this thread and this one for details.
Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

Implementing Patterns

 
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!!
 
author
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.
 
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.
 
Sometimes you feel like a nut. Sometimes you feel like a tiny ad.
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps
https://coderanch.com/t/722574/Sauce-Labs-World-Largest-Continuous
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!