This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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.
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?