构建远程代理时,Java 中合适的术语是什么?

发布于 2024-08-26 19:18:03 字数 258 浏览 6 评论 0原文

假设我正在 Java 中实现一个对象的远程代理,该对象可能驻留在远程服务器上,但也可能驻留在本地。

远程服务器上有我的真实对象,有本地实现(代理本身),还有我为程序提供的接口,该接口隐藏了对象实际位置的详细信息。本地表示可以联系对象的本地或远程实现。

Java 中这些东西的标准术语是什么?我应该为我的接口/类命名什么?

我见过术语“主题”、“图像”和“实现”(可能是从 GOF 时代开始),但我想知道用 Java 编写的框架的命名可接受的方式是什么。

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 details 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

无声情话 2024-09-02 19:18:03

由于远程处理通常需要某种服务,例如调用,因此我通常使用服务接口、远程代理和服务实现。由于实现是在运行时确定的(代理或实现),因此所有编码都针对服务接口完成,因为它是唯一的公共 API。

Spring Remoting 使这变得非常简单,我们广泛使用它来通过 HTTP、EJB 和 JMS 为相同的服务提供远程代理。也使得没有任何代理的测试变得微不足道。我们可以直接针对实现运行相同的单元测试,以及针对服务器的集成测试。

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.

番薯 2024-09-02 19:18:03

即使您决定不实际使用 RMI,您也可能希望使用 RMI 使用的相同术语。例如:存根、骨架、注册表、服务器...

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...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文