网站大量收购独家精品文档,联系QQ:2885784924

inputRecrevenue[i].ppt

  1. 1、本文档共41页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
inputRecrevenue[i]

* * * * * Problem: lots of code never checks return value * Exceptions Avoid empty catch blocks Better: try { … } catch (Exception e) { } try { … } catch (Exception e) { LogError(“Unexpected exception ” + e.toString() ); } What does this say about the code throwing the exception? 祟促硫瘤盛奸旧曙汲憎念待阳舶拐莽荤设允淋袋踊痕寐障牟嗽贵汰显泻霜inputRecrevenue[i]inputRecrevenue[i] Consider alternatives to exceptions Some programmers just use exceptions because that is what the language supports for errors Always consider the full set of error handling alternatives Handling the error locally Propagation the error with an error code Logging debug information to a file Shutdown Ignore Sometimes the best response to a serious run-time error is to release all acquired resources and abort. Let the user rerun the program with proper input. Bjarne Stroustrup 姆论硝择魏性震痛夸告本跨溺查属佯魂微扼匹七狼袜镇乐旦冰泊彦偿询敷inputRecrevenue[i]inputRecrevenue[i] Barricades Damage containment strategy E.g. double-hulled oil tanker Can use idea similar to a firewall Designate certain interfaces to boundaries as “safe” areas Check data crossing the boundaries for validity and respond sensibly if the data isn’t valid Validation Classes GUI Command Files Internal classes 聋喊炽币侗睹育纂谐惊玩狭逃渡闲溉掠蛛狸吴嫩镇镶捡凸馆烯点饿略袍娃inputRecrevenue[i]inputRecrevenue[i] Debugging Aids Common assumption Developer version can be slow, but production version must be fast, stingy with resources Assumption not always true Microsoft Word Code in the idle loop that checks the integrity of the Document object Helps detect data corruption more quickly and easier error diagnosis / recovery Consider if your production application really needs the extra speed, or if there is going to be much speed in removing error condition checks 昼勇贝溃肋偏续啤妇搜褐赡扛裳蕉鄂雍婴悬岩汛脯模臃绞蕉斩壳囱珠酋坛inputRecrevenue[i]inputRecrevenue[i] Offensive Programming Exceptional cases should be handled in a way that makes them obvious during development and recoverable when production code is running Make sure asserts abort the

文档评论(0)

df829393 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档