• 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
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

DTO and multiple clients

 
Greenhorn
Posts: 11
  • 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
 
Greenhorn
Posts: 16
  • 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
  • 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
 
Ranch Hand
Posts: 187
  • 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
  • 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
 
Your mother is a hamster and your father smells of tiny ads!
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic