aspose file tools*
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes DTO and multiple clients Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "DTO and multiple clients" Watch "DTO and multiple clients" New topic
Author

DTO and multiple clients

Pal andy
Greenhorn

Joined: Sep 10, 2004
Posts: 11
Hi,

This is an architecture problem that I am currently facing. I didnt know where to post it. Architects, please help me.

I am designing a web app. I have created interfaces to communicate between client and server. The problem is, there is going to be another UI for a different customer. The functionality may be a little different than my UI. So, if they also define their own interfaces to communicate with the server, does the server (business tier) have to cater to all the needs of the different UIs or does the server provide one set of interfaces to meet the requirements of both the UIs? In that case the DTO will be a huge object which contains all the information related to all the UIs whether or not they need it.

Thanks in advance
Alok Sharma
Greenhorn

Joined: May 17, 2004
Posts: 16
I suggest this: Define a DTO interface, lets called baseDTO.java and implement this interface by two DTO objects let's say ui1DTO and ui2DTO.These object would define only those attributes which are needed for the respective UIs.

Pass a flag from UI when they send request to server and based on the flag the server should populate corresponding utDTO and send it back to the called UI.

Based on you design of the server object you can choose to define different business methods for each caller UI.
Pal andy
Greenhorn

Joined: Sep 10, 2004
Posts: 11
Hi,

Thanks for the reply. I can definitely do this. But the business tier team doesnt want to change the code every time a new UI is added. Lets say another customer wants to customize the UI. Does this mean that the server must process the flag for the third type of the UI and pass the DTOs to the respective UI? Is there any way to work around this?

Thanks

Pal
Devender Thareja
Ranch Hand

Joined: Jul 14, 2005
Posts: 187
Business tier folks can decide their interface and stick to it.
Each UI team can write adapter classes, if the interface provided by business tier is not usable by them as it is.
Look at adapter pattern for details.


Devender Thareja
SCEA, SCBCD, SCJP
Pal andy
Greenhorn

Joined: Sep 10, 2004
Posts: 11
Thanks for the inputs. The adapter pattern looks like a neat solution. I will go with it.

Thanks
Pal
 
Consider Paul's rocket mass heater.
 
subject: DTO and multiple clients