This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Java in General and the fly likes Employing polymorphism in client server architecture Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "Employing polymorphism in client server architecture" Watch "Employing polymorphism in client server architecture" New topic
Author

Employing polymorphism in client server architecture

Fabio Piergentili
Ranch Hand

Joined: Sep 04, 2009
Posts: 57
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.

Thanks
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3071
    
  33

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?


Mohamed Sanaulla | My Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Employing polymorphism in client server architecture