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.
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.
Joined: Sep 10, 2004
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?
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.
SCEA, SCBCD, SCJP
Joined: Sep 10, 2004
Thanks for the inputs. The adapter pattern looks like a neat solution. I will go with it.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com