This content has been marked as final. Show 5 replies
Thanks Mithun.. I cleared that doubt. But one doubt,That proxy class will again have remote access isnt?
For example I have one ServiceManager class which is in the server and one method getEmployeeDetails() in the ServiceManager class. So whenever I invoke the getEmployeeDetails class in the proxy class will it automatically call the ServiceManager class in the server side?
The approach I am familiar with (if you are not using a remoting framework) is to make ServiceManager an interface and have two implementations; one that resides on your server (this is the full implementation) and one that resides on the client. The client side implementaton (called the proxy) has a very lightlight implementation which delegates all calls to it to the server side object using whatever remoting technnology you are using.
Hope this helps.
Hi Paratheosis ,
I almost got the point. But what I have heard about proxy pattern is, we use proxy to reduce the traffic between
client and server. In this case whenever we need any method on the server side we call isnt?..how trafic is being reduced here? Or is it storing somewhere client when we first time access the Object in Server side? for example
In Servicemanager getEmployeedetails.. So in client do we store the ServiceManager object so that next time we can access the that ServiceManager object in the client side.. Is it in this way? I dont think because any updation on the ServiceManager will not be able to get in the client side? I totally confused the implements for proxy.. :(
The Proxy pattern isn't primarily used to reduce traffic, but to hide from the client the messy technical details of calling the remote (server) side implementation.
I think you are confusing the Proxy pattern with the more involved Half Object Protocol Pattern (HOPP ref: Applied Java Patterns (Stelting & Maasen) pp189.
Take a look the reference or google it, it may help.