The nature of Exceptions
there are three different situations that cause exceptions to be thrown:
1. Exceptions due to programming errors
2. Exceptions due to client code errors
3. Exceptions due to the resource failures
Types of Exceptions in java
1. Checked Exceptions
2. Unchecked Exceptions
Best Practices for Designing the API
1. When deciding on checked exceptions vs.unchecked excpetions,ask yourself
"what action can client code take when excpetion occurs?"
2. Preserve encapsulation
3. Try not to create new custom exception if they don't have useful information
for client code.
4. Document exceptions
Best practices for using exceptions
1. Always clean up after yourself
2. never use excpetions for flow control
3. Do not suppress or ignore exceptions
4. Do not catch top-level exceptions.
5. Log exceptiions just once
you can refer to the original article of best practices of exception handling at fellowing link
http://onjava.com/pub/a/onjava/2003/11/19/exceptions.html
分享到:
相关推荐
Chapter 9: Best Practices for Function-Based Views Chapter 10: Best Practices for Class-Based Views Chapter 11: Form Fundamentals Chapter 12: Common Patterns for Forms Chapter 13: Templates: Best ...
NHTSA_Cybersecurity Best Practices for Modern Vehicles
High Performance Spark Best Practices for Scaling and Optimizing Apache Spark 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
High Performance Spark Best Practices for Scaling and Optimizing Apache Spark 英文azw3 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除
This document is intended to help those with a basic knowledge of machine learning get the benefit of best practices in machine learning from around Google. It presents a style for machine learning,...
Defensive Security Handbook: Best Practices for Securing Infrastructure by Lee Brotherston English | 3 Apr. 2017 | ASIN: B06Y18XC5Y | 268 Pages | AZW3 | 3.88 MB Despite the increase of high-profile ...
AWS Best Practices for DDoS Resiliency,是基于AWS上安全服务shield和WAF ALB和cloudfont已经Route53构建适合不同应用部署架构的防拒绝服务攻击的文档,可以帮助用户设计适合的防护机制。
Building Software Teams: Ten Best Practices for Effective Software Development English | 31 Dec. 2016 | ISBN: 149195177X | 136 Pages | AZW3/MOBI/EPUB/PDF (conv) | 6.49 MB Why does poor software ...
Best Practices for Upgrades to Oracle Database 11g Release 2 CN
3. SAP Best Practices for SAP Cloud Platform - This set of best practices focuses on cloud-based development and integration scenarios, assisting customers in leveraging the full potential of the SAP ...
High Performance Spark: Best Practices for Scaling and Optimizing Apache Spark by Holden Karau English | 25 May 2017 | ASIN: B0725YT69J | 358 Pages | AZW3 | 3.09 MB Apache Spark is amazing when ...
High Performance Spark Best Practices for Scaling and Optimizing Apache Spark 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或...
Learning Spark Streaming Best Practices for Scaling and Optimizing Apache Spark(Early Release) 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权...
"High Performance Spark Best Practices for Scaling and Optimizing Apache Spark" 这一主题深入探讨了如何最大化利用Spark的性能,以及如何进行有效扩展和优化。以下是一些关键的知识点: 1. **资源管理与调度**...
Perl Best Practices author Damian Conway explains that rules, conventions, standards, and practices not only help programmers communicate and coordinate with one another, they also provide a reliable ...
《微服务最佳实践 for Java》是由IBM公司推出的英文版指南,深入探讨了在Java环境中实现微服务架构的各种最佳策略和技巧。微服务架构是一种将单一应用程序拆分为一组小型、独立的服务的方法,每个服务都能在其自己的...
现代车辆的网络安全已经成为一个备受关注的问题,因为随着车辆智能化和互联化程度的不断提升,其面临的网络攻击风险也随之增加。车辆制造商和售后市场设备制造商都需要采取一系列网络安全最佳实践,以确保现代车辆的...
wo Scoops of Django: Best Practices For Django 1.8 is chock-full of even more material that will help you with your Django projects.
Best Practices for Performance Sending Operations to Multiple Threads