File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DTO and multiple clients

 
Pal andy
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 187
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Pal andy
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the inputs. The adapter pattern looks like a neat solution. I will go with it.

Thanks
Pal
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic