开发者

What is the appropriate terminology in Java when building remote proxies?

Suppose that I am implementing a remote proxy in Java to an object that is likely to reside on a remote server but may reside locally.

There's my real object on the remote server, there's the local implementation (the proxy itself), and there's the interface I provide to my program which hides the detail开发者_JS百科s of where the object actually is. The local representation may contact a local or a remote implementation of the object.

What is the standard terminology in Java for these things? What should I name my interfaces/classes?

I've seen the terms Subjects, Images, and Implementations thrown around (probably from the GOF days), but I wonder what is acceptable way to do the naming for a framework written in Java.


Since remoting usually entails some kind of service like call, I usually go with service interface, remote proxy and service implementation. Since the implementation is determined at runtime (proxy or implementation), all coding is done to the service interface as it is the only public API.

Spring Remoting makes this very easy, we use it extensively to provide remote proxies over HTTP, EJB and JMS to the same services. Also makes testing without any proxy trivial as well. We can run the same tests for unit tests directly against the implementation, as well as integration tests against a server.


You may want to use the same terminology that RMI uses, even if you've decided not to actually use RMI. eg: stubs, skeletons, registries, servers...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜