什么应该包括在最先进的错误和异常处理策略? [英] What should be included in the state-of-the-art error and exception handling strategy?

查看:113
本文介绍了什么应该包括在最先进的错误和异常处理策略?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我明白这是一个非常广泛的问题,但一个简短的依赖的答案将不被接受。策略出生在处理广泛的问题。


  1. 应用程序设计师在设计错误和异常处理时应考虑什么问题策略?


  2. 根据软件类型(COTS,内部商业应用,咨询软件,游戏,托管网络应用,嵌入式等),策略将如何变化?软件类型是否重要?


  3. 伦理,政治和法律问题?


  4. 各种观点错误处理,开发商,业务支持,管理)。


我会探讨的一些想法:




  • 各种错误报告路线(即UI,日志记录,自动管理通知)。


  • 深度防御和鲁棒性(故障转移应急和故障安全机制,针对尚未知道的问题的恢复)


  • 公平地对待用户和客户(即尽量减少对软件用户和软件服务的其他人员的影响)。




我正在寻找类似的想法和概念列表。



请使用评论如果我需要进一步澄清这个问题,谢谢大家的贡献!






常见问题



开发平台(Java,.NET,移动) - 肯定会对结果的实现细节产生一些影响从用户的角度来看,策略是不够的。



愚人节当然不是。我被要求工作的大多数遗留系统没有明确的错误处理策略。



这可以成为社区wiki吗?这似乎是一个很好的问题,很难想出好的问题。



这个策略是什么意思?长期计划给出方向,重点,带来错误和异常处理的一致性和协调性。如果一个更大的团队在软件上工作,该策略可以被形成并以书面形式分发。



这似乎是重复的问题(见 Java或C中异常管理的最佳做法哪个和你为什么喜欢异常或返回代码这些问题涉及错误处理(主要是开发人员)的一些观点,我想了解更多有关其他视角的信息,以及它们如何为整体策略做出贡献。

解决方案

这里有很多可能的答案,但是我会解释一下。



应用设计师在设计错误和异常处理策略时应考虑哪些问题?


  1. Wh你有多个开发人员,应该很容易挂钩你的错误处理框架,否则人们不会使用它。

  2. 明智地使用事务来维护数据的一致性。我看到所有的应用程序,一个失败可能发生在一个进程中途,并导致数据不一致,因为整个操作没有正常回滚。

  3. 在处理异常时,考虑关键性。例如,如果您有一个在线订购系统,并且该工作流程的一部分是将电子邮件发送给网站所有者,让他们知道新的订单已被放置。如果发送电子邮件失败,用户是否收到错误,整个订单将被取消?

该策略将根据软件类型(COTS,内部业务应用程序,咨询软件,游戏,托管网络应用程序,嵌入式等)而有所不同。软件类型重要吗?


  1. 对于桌面类型或嵌入式应用程序,记录有关环境的信息(os版本,硬件,

  2. 对于企业应用程序和网络应用程序,例如电子邮件错误通知,短信和ECO工具集成(例如,其他应用程序等)可能非常有用。 Tivoli)变得非常有用。

伦理,政治和法律问题? b

我可以想到的只有桌面应用程序 - 手机主页类型的应用程序通常是皱眉的,特别是如果他们提交有关可能敏感的用户机器的信息。



对错误处理(用户,开发人员,业务支持,管理)的各种观点。


  1. 从用户的角度来看,通过设计界面,尽量避免错误,使他们难以犯错。不要提出用户可能无法回答的问题(中止,重试,任何人失败?)


  2. 从开发人员的角度来看,我想要尽可能多的信息来帮助诊断发生了什么 - 堆栈跟踪,环境信息等。


  3. 从业务支持&管理层的观点,他们想知道如何处理错误(主要是在企业环境中) - 负责应用程序的人员(我打电话/页面/等等)以及关键性和任何可能的副作用(例如,如果此批处理作业失败,那么会影响哪些业务流程?书面文件是您的朋友。



I understand that this is a very broad question, but a short "it depends" kind of answer will not be accepted. Strategies are born to deal with broad issues.

  1. What issues should an application designer take into consideration when devising the error and exception handling strategy?

  2. How the strategy will differ depending on the software type (COTS, in-house business app, consultingware, game, hosted web app, embedded etc)? Is the software type important?

  3. Ethical, political and legal issues?

  4. Various perspectives on error handling (user, developer, business support, management).

Some ideas that I would have explored:

  • Various error reporting routes (i.e. UI, logging, automatic admin notification).

  • Defence in depth and robustness (failover contingency and fail-safe mechanisms, recovery against problems that are not yet known).

  • Treating users and customers fairly (i.e. minimising the impact on software users and other people serviced by software).

I'm looking for a similar list of ideas and concepts.

Please do use comments to point me out if I need to clarify the question further and thanks to everyone contributing!


FAQ

Development Platform (Java, .NET, mobile) — will definitely have some affect on the resulting implementation detail of the strategy from a developer perspective but less so from users' point of view.

Fools day it is certainly not. Most legacy systems I was asked to work on did not have a clear error handling strategy.

Could this be made a community wiki? No. It seems as a good question and good questions are hard to come up with.

What do you mean by the strategy? A long term plan that gives direction, focus, brings consistency and coordination to error and exception handling. In case of a larger team working on software the strategy can be formilised and distributed in a written form.

It seems to be duplicate question (see Best practices for exception management in Java or C and Which and why do you prefer exceptions or return codes) These questions deal with a certain perspective on error handling (mostly developer), I'd like to learn more about other perspectives and how they contribute to the overall strategy.

解决方案

There are so many possible answers here, but I'll take a crack at it.

What issues should an application designer take into consideration when devising the error and exception handling strategy?

  1. When you have multiple developers, it should be easy to "hook into" your error handling framework, otherwise people won't use it.
  2. Use transactions wisely to maintain data consistency. I see apps all the time where a failure could occur halfway through a process and cause wierd data inconsistencies because the entire operation was not rolled back properly.
  3. Consider criticality when you handle exceptions. For example, if you have an online ordering system and part of that workflow is to have an e-mail sent to the site owner letting them know that a new order was placed. If sending that e-mail were to fail, should the user get an error and the whole order be cancelled?

How the strategy will differ depending on the software type (COTS, in-house business app, consultingware, game, hosted web app, embedded etc)? Is the software type important?

  1. For desktop type or embedded apps, recording information about the environment (os version, hardware, other apps running, etc) can be very useful when investigating error reports.
  2. For enterprise apps and web apps, things like e-mail error notifications, SMS messaging and integration with ECO tools (e.g. Tivoli) become very useful.

Ethical, political and legal issues?

The only thing I can think of here would be for desktop apps - "phone home" type applications are generally frowned upon, especially if they submit information about the users machine that could be sensitive.

Various perspectives on error handling (user, developer, business support, management).

  1. From a user perspective, try to avoid errors by designing the interface in such a way that it is difficult for them to make mistakes. Don't ask questions that the user probably won't be able to answer (Abort, Retry, Fail anyone?)

  2. From a developer perspective, you'll want as much information as possible to help diagnose what happened - stack trace, environment info, etc.

  3. From a business support & management standpoint, they'll want to know what to do about the error (mostly in an enterprise environment) - who is responsible for the application (who do I call/page/etc?) as well as the criticality and any possible side effects (e.g. if this batch job fails, what business processes will that affect?). Written documentation is your friend here.

这篇关于什么应该包括在最先进的错误和异常处理策略?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆