- 1、本文档共41页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 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
您可能关注的文档
- 语文网站目录.doc
- 语文试卷(自己搞的).doc
- 语文读本必修三文言文.doc
- 语文课外知识.doc
- 语文课堂教学中的导入艺术.doc
- 语文选修目录.doc
- 语文课本文言实词整理(九).doc
- 语文课本文言实词整理(十).doc
- 语文阅读技巧.doc
- 语文第二阶段答案.doc
- 2025-2030中国凝胶泡沫床垫行业市场发展趋势与前景展望战略研究报告.docx
- 2025-2030中国压槽机行业市场全景调研及投资价值评估咨询报告.docx
- 2025-2030中国双酚钠行业市场发展趋势与前景展望战略研究报告.docx
- 2025-2030中国基因药物行业市场发展分析及前景趋势与投资机会研究报告.docx
- 2025-2030中国多肽试剂行业市场全景调研及投资价值评估咨询报告.docx
- 2025-2030GPS导航系统产业政府战略管理与区域发展战略研究咨询报告.docx
- 2025-2030中国PPO树脂行业市场发展趋势与前景展望战略研究报告.docx
- 2025-2030中国三极管行业供需趋势及投资风险研究报告.docx
- 2025-2030中国下一代处理器行业市场发展趋势与前景展望战略研究报告.docx
- 2025-2030中国便携式压缩机雾化器行业市场发展趋势与前景展望战略研究报告.docx
最近下载
- 小学副高个人专业技术总结.pptx
- GB 50300-2013 建筑工程施工质量验收统一标准.docx
- 抖音:短视频与直播运营PPT完整全套教学课件.pptx VIP
- 高级卫生专业技术资格考试病媒生物控制技术(096)(正高级)试卷与参考答案(2024年).docx VIP
- 高级卫生专业技术资格考试病媒生物控制技术(096)(副高级)自测试卷及解答参考.docx VIP
- 北海市-魅力北海,向海而生PPT模板.pptx
- 高级卫生专业技术资格考试病媒生物控制技术(096)(正高级)新考纲试题集精析.docx VIP
- 2025年高级卫生专业技术资格考试病媒生物控制技术(096)(副高级)知识点必刷题详解.docx VIP
- 2024年四川西华师范大学招聘辅导员真题.docx VIP
- 副食品供货配送项目投标方案(338).docx
文档评论(0)