每个业务对象都应该是一个服务吗?
我知道当你将 Web 服务与直接代码进行比较时,性能可能是一个问题。但随着 SOA 的兴起,我不得不考虑是否应该计划将应用程序中的每个业务对象都变成 Web 服务(WCF 或 .asmx)。
.NET 4 中 WCF 的改进无疑让我重新审视。
I know performance can be an issue with web services when you compare them to direct code. But with SOA on the rise, I have to wonder if I should be planning to make every business object in my apps into a web service, either WCF or .asmx.
The improvements to WCF in .NET 4 are definitely making me give is a second look.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
SOA 是指独立系统与其他独立系统进行通信。如果您遇到一个系统需要了解另一个系统的操作或数据的场景,那么服务可能就是答案,但并非您创建的每个对象都不需要通过服务使用。所有其他人都是完全正确的。有道理吗?和简单吗?
SOA is about independent systems talking to other independent systems. If you have a scenario where one system needs to know about the actions or data of another system, a service might be the answer, but not every object you ever create will not need to be consumed via a service. And all the other guys are exactly correct. Does it make sense? and Is it simple?
无论“未来”、酷炫的新技术等等如何,有一个原则永远不会过时:简单。
我的一般方法是让事情尽可能简单。我们今天拥有的开发工具可以让您在需要时轻松地将普通业务对象“升级”为 Web 服务。
只是盒子里少了几根不需要的电线。加上免费的性能提升:)
Regardless of 'the future', cool new technologies and the like, one principle never goes out of date: Simplicity.
My general approach is to keep things as simple as possible. The dev tools we have today makes it delightfully easy to 'upgrade' a normal business object into a webservice when you need to.
Just a few less wires inside the box that are not needed. Plus a free performance boost :)
无论教条如何,正确的答案都是由“这有意义吗?”的答案给出的。
将您的
Employee
业务对象作为服务提供是否有意义?也许是这样。将WarehouseShelfLocationArchive
业务对象作为服务提供是否有意义?也许不是。如果不是,仅仅因为时尚就这样做是愚蠢的。Regardless of dogma, the correct answer is given by the answer to "does it make sense?"
Does it make sense to make your
Employee
business object available as a service? Maybe so. Does it make sense to have yourWarehouseShelfLocationArchive
business object available as a service? Maybe not. If not, it's foolish to do so only because it's fashionable.@gabe 是对的,您需要确保使对象服务有意义。然而,我还发现,一旦你构建了一项服务,其他人就会使用它。我在我写的服务中一遍又一遍地看到这一点:“如果你构建它,他们就会来”。
@gabe is right that you need to make sure that making objects services makes sense. However, I've also found that once you build a service, others will consume it. I've seen this over and over again in the services I've written: "if you build it, they will come".