摘要:
一、抛出异常 vs. 返回错误代码有人说“Well, an exception is a goto.”,但也有人言“makes the code simpler by visibly separating the general case of expected processing from the special cases of errors.”简单地分析一下两者优劣。异常的优点:让代码更简洁,不再到处if-return;无论CheckedEx还是UnCheckEx都会强迫调用方或系统处理;Exception Chain和继承体系,可以解耦检测错误和错误处理,方便包装异常和控制错误链;异 阅读全文
posted @ 2014-02-12 20:17
软件真理与光
阅读(1578)
评论(0)
推荐(0)
浙公网安备 33010602011771号