如何管理应用程序的外部依赖关系?
外部依赖有多种类型。 与外部应用程序、组件或服务交互(例如,用于发送电子邮件的 Outlook、用于扫描的 TWAIN 或 WIA、用于各种目的的 ActiveX 对象和 Web 服务等)。
您的策略是什么来确保您的应用程序健壮,并且即使在此类外部依赖项(由于无数原因)不可用时也可以运行?
注意:您自己的源代码中包含的来自外部源的代码是另一种类型的外部依赖项,但这不是我在这里主要关心的。
There are many types of external dependencies. Interfacing with external applications, components or services (e.g. Outlook to send emails, TWAIN or WIA for scanning, ActiveX objects and Web services for various purposes, and so on).
What is your strategy for making sure that your application is robust, and can run even when such external dependencies (for innumerable reasons) are unavailable?
Note: Code from external sources included in your own source code is another type of external dependency, but that is not mainly what I am concerned about here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我们的策略是,除非在特殊情况下,否则我们的软件可能不会这样做。 因此,我们的编程相当防御性:
还有更多。
Our strategy, is that our software may not except in exceptional circumstances. So we program quite defensively:
And there are more.
另请注意,对于外部接口,就像用户输入一样,您不应该信任该输入。 始终验证输入,并在调用时检查一致性(或存在性)。
Also note, that with external interfaces, much as with user input, you should not trust that input. Always validate input, and check for consistency (or existence) when calling.