复旦大学:《面向对象分析和设计》课程资料_Error Handling

Error Handling OOA/OOD xuyingxiao@126.com
Error Handling OOA/OOD xuyingxiao@126.com

Error Handling patterns Big Outer Try Block Hide Technical Detail from Users Log at Distribution Log Unexpected Boundary Errors Unique Error Split Domain and Make Exceptions Identifier Technical errors Exceptional
Error Handling Patterns

plit Domain and Technical Errors domain errors'' are due to errors in the business logic or business processing(e. g. wrong type of customer for insurance policy) technical errors", are caused by problems in the underlying platform(e.g, could not connect to database)or by unexpected faults(e.g. divide by zero e Handling technical errors in domain code makes this code more obscure and difficult to maintain
Split Domain and Technical Errors “domain errors”, are due to errors in the business logic or business processing (e.g. wrong type of customer for insurance policy). “technical errors”, are caused by problems in the underlying platform (e.g. could not connect to database) or by unexpected faults (e.g. divide by zero). Handling technical errors in domain code makes this code more obscure and difficult to maintain

e Solution Split domain and technical error handling Create separate exception/error hierarchies and handle at different points and in different ways as approprlate
Solution Split domain and technical error handling. Create separate exception/error hierarchies and handle at different points and in different ways as appropriate

Domain Exception System exception CustomerNotFound Exception InsufficientFunds Exception Transaction Refused Exception

e public class DomainEXception extends Exception Public class InsufficientFunds Exception extends . Exception public class SystemEXception extends Exception
public class DomainException extends Exception { ... } Public class InsufficientFundsException extends …Exception { ... } public class SystemException extends Exception { ... }

public float withdrawFunds (float amount e throws InsufficientFunds Exception, SystemException Domain code that could generate various errors both technical and domain catch(Domain Exception ex throw ex catch(Exception ex) throw new SystemException(ex)
public float withdrawFunds(float amount) throws InsufficientFundsException, SystemException { try { // Domain code that could generate various errors // both technical and domain } catch (DomainException ex) { throw ex; } catch (Exception ex) { throw new SystemException(ex); } }

Error Handling patterns Big Outer Try Block Hide Technical Detail from Users Log at Distribution Log Unexpected Boundary Errors Unique Error Split Domain and Make Exceptions Identifier Technical errors Exceptional
Error Handling Patterns

Big outer Try Block e Errors will propagate right to the edge of the system and will appear to crash the application if not handled at that point e Users are mostly on remote sites and will not do much to report errors
Big Outer Try Block Errors will propagate right to the edge of the system and will appear to “crash” the application if not handled at that point. Users are mostly on remote sites and will not do much to report errors

e Solution e Implement a Big Outer Try Block at the "edge" of the system to catch and handle errors that cannot be handled by other tiers of the system. The error handling in the block can report errors in a consistent way at a level of detail appropriate to the user constituency
Solution Implement a Big Outer Try Block at the “edge” of the system to catch and handle errors that cannot be handled by other tiers of the system. The error handling in the block can report errors in a consistent way at a level of detail appropriate to the user constituency
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 复旦大学:《面向对象分析和设计》课程资料_AntiPattern_2.Servlet.pdf
- 复旦大学:《面向对象分析和设计》课程资料_AntiPattern_1.JSP J2EE Refactoring Patterns/AntiPatterns.pdf
- 复旦大学:《面向对象分析和设计》课程资料_分析模式_责任模式 Accountability.pdf
- 复旦大学:《面向对象分析和设计》课程资料_分析模式_观察和测量模式.pptx
- 复旦大学:《面向对象分析和设计》课程资料_UML&GRASP_UMLProfile.pdf
- 复旦大学:《面向对象分析和设计》课程资料_UML&GRASP_5.5 Iteration 3 持久化框架 DESIGNING A PERSISTENCE FRAMEWORK WITH PATTERNS.ppt
- 复旦大学:《面向对象分析和设计》课程资料_UML&GRASP_5.4 Iteration 3 状态图 MODELING BEHAVIOR IN STATECHART DIAGRAMS.ppt
- 复旦大学:《面向对象分析和设计》课程资料_UML&GRASP_5.3 Iteration 3 SSD和合约 ADDING NEW SSDs AND CONTRACTS.ppt
- 复旦大学:《面向对象分析和设计》课程资料_UML&GRASP_5.2 Iteration 3 领域模型 MODELING GENERALIZATION & REFINING THE DOMAIN MODEL.ppt
- 复旦大学:《面向对象分析和设计》课程资料_UML&GRASP_5.1 Iteration 3 用例加关系.ppt
- 复旦大学:《面向对象分析和设计》课程资料_UML&GRASP_4.2 Iteration 2 用GoF设计用例实现 DESIGNING USE-CASE REALIZATIONS WITH GoF DESIGN PATTERNS.ppt
- 复旦大学:《面向对象分析和设计》课程资料_UML&GRASP_4.1 Iteration 2 GRASP:MORE PATTERNS.ppt
- 复旦大学:《面向对象分析和设计》课程资料_UML&GRASP_3.5 Iteration 1 实现模型.ppt
- 复旦大学:《面向对象分析和设计》课程资料_UML&GRASP_3.4 Iteration 1 设计模型 GRASP——设计带职责的对象.ppt
- 复旦大学:《面向对象分析和设计》课程资料_UML&GRASP_3.4 Head 2 On to Object Design.ppt
- 复旦大学:《面向对象分析和设计》课程资料_UML&GRASP_3.4 Head 1 Logical Architecture and UML Package Diagrams.ppt
- 复旦大学:《面向对象分析和设计》课程资料_UML&GRASP_3.3 Iteration 1 用例模型——操作合约添加细节.ppt
- 复旦大学:《面向对象分析和设计》课程资料_UML&GRASP_3.2 Iteration 1 用例模型——SSD.ppt
- 复旦大学:《面向对象分析和设计》课程资料_UML&GRASP_3.1 Iteration 1 领域模型——概念的可视化.ppt
- 复旦大学:《面向对象分析和设计》课程资料_UML&GRASP_2 Inception 用例模型和其他需求.ppt
- 复旦大学:《面向对象分析和设计》课程资料_Exception handling refactorings.pdf
- 复旦大学:《面向对象分析和设计》课程资料_课程注册系统_1-5 最佳实践、需求、分析设计、架构分析、用例分析.pdf
- 复旦大学:《面向对象分析和设计》课程资料_课程注册系统_6-8 Identify Design Elements、RunTime Architecture、Describe Distribution.pdf
- 复旦大学:《面向对象分析和设计》课程资料_课程注册系统_9-11 UC Design、Subsystem Design、Class Design.pdf
- 复旦大学:《面向对象分析和设计》课程资料_UML和模式_Chapter 1 - 面向对象分析和设计.ppt
- 复旦大学:《面向对象分析和设计》课程资料_UML和模式_Chapter 2 - 迭代、进化和敏捷.ppt
- 复旦大学:《面向对象分析和设计》课程资料_UML和模式_OOP:Object-Oriented Programming.pptx
- 复旦大学:《面向对象分析和设计》课程资料_UML和模式_Chapter 3 - 案例分析 THE NEXTGEN POS SYSTEM.ppt
- 复旦大学:《面向对象分析和设计》课程资料_UML和模式_Chapter 4 Chapter 5 - 初始阶段的需求.ppt
- 复旦大学:《面向对象分析和设计》课程资料_UML和模式_Chapter 6 - 用例.ppt
- 复旦大学:《面向对象分析和设计》课程资料_UML和模式_Chapter 7 - 其他需求.ppt
- 复旦大学:《面向对象分析和设计》课程资料_UML和模式_Chapter 8 - 细化阶段的迭代——基础.ppt
- 复旦大学:《面向对象分析和设计》课程资料_UML和模式_Chapter 9 - 领域模型.ppt
- 复旦大学:《面向对象分析和设计》课程资料_UML和模式_Chapter 10 - 系统顺序图.ppt
- 复旦大学:《面向对象分析和设计》课程资料_UML和模式_Chapter 11 - 操作契约.ppt
- 复旦大学:《面向对象分析和设计》课程资料_UML和模式_Chapter 13 - 逻辑架构和UML包图.ppt
- 复旦大学:《面向对象分析和设计》课程资料_UML和模式_Chapter 14 - 迈向对象设计.ppt
- 复旦大学:《面向对象分析和设计》课程资料_UML和模式_Chapter 15 - UML交互图.ppt
- 复旦大学:《面向对象分析和设计》课程资料_UML和模式_Chapter 16 - UML类图.ppt
- 复旦大学:《面向对象分析和设计》课程资料_UML和模式_Chapter 17 - GRASP基于职责设计对象.ppt