This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Building Blockchain Apps and have Michael Yuan on-line!
See this thread for details.
Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

Employing polymorphism in client server architecture

Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a client server architecture using tomcat and swing. I am trying to avoid big switch statements on the server side. I am trying to do that using polymorphism but I am running into some difficulties. In short the problem is that the object which implements an interface needs to be instantiated on the client side. The method that it defines uses a Database Access Object ( DAO ). It will be employed on the server side but needs to be defined on the client side b/c that is where we know what it should be. The problem is that I can't compile it as the common code is compiled first then the client and finally the server. I could put all the code in the common side but that does not seem right as the DAO object can only be used on the server side.

Has anyone experienced this type of problem and have any thoughts they could share.

Posts: 3225
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont know if I have correctly understood your technical requirements. Its a bit difficult to understand with just words. A small sample would have helped. Nevermind, thought I could share few things here:

DAO Objects- Obtain the data and wrap it in to beans and then forward them to the client side (I would be considering some JSPs?). So now which DAO to use on the server side depends on which data you would want to fetch. And that depends on the request from the client.

Always there should be loose coupling between difference components and each component must be highly focused on its operation.

And Am still thinking- client-server architecture using Tomcat and Swing? How is this possible? Or is it an Applet being used?
The only taste of success some people get is to take a bite out of you. Or this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!