1. A general principle is that you should attempt to detect errors as soon as possible after they occur. Failing to do so makes it less likely that an error will be detected and makes it harder to determine the source of an error once it has been detected.
2. For public methods, use the Javadoc @throws tag to document the exception that will be thrown if a restriction on parameter values is violated.
3. For an unexported method, you as the package author control the circumstances under which the method is called, so you can and should ensure that only valid parameter values are ever passed in. Therefore, nonpublic methods should generally check their parameters using assertions.
4. Assertions throw AssertionError if they fail. And unlike normal validity checks, they have no effect and essentially no cost unless you enable them, which you do by passing the -ea (or -enableassertions) flag to the java interpreter.
5. It is particularly important to check the validity of parameters that are not used by a method but are stored away for later use. Constructors represent a special case, It is critical to check the validity of constructor parameters to prevent the construction of an object that violates its class invariants.
6. The fewer restrictions that you place on parameters, the better, assuming the method can do something reasonable with all of the parameter values that it accepts.
7. Each time you write a method or constructor, you should think about what restrictions exist on its parameters. You should document these restrictions and enforce them with explicit checks at the beginning of the method body.
相关推荐
Item 49: Check parameters for validity Item 50: Make defensive copies when needed Item 51: Design method signatures carefully Item 52: Use overloading judiciously Item 53: Use varargs judiciously Item...
Learn basic concepts for testing the origin and validity of data Transform your data into stable and usable numerical values Understand supervised and unsupervised learning algorithms, and methods for...
Validity90, 有效/synaptics 138a的反向工程 Validity90本项目的目的是对有效的138 a:0090, 138 a:0094, 138 a:0097, 06: 0081.指纹读取器进行反向工程,创建规范和牙线libfprint驱动程序。讨论这里项目的主要聊天:...
The Rosenberg Self-Esteem scale and Harter's Self-Perception profile for adolescents: a concurrent validity study 132 Fianagan and Alfonso SATTLER. J. M. (1992). Assessment ofchildren (rev. 3rd ed...
linux_check_password_complex_validity-2.xml
jQuery表单验证插件 jQuery.validity
The relation of the Stanford-Binet: Fourth edition to measures of achievement: A Concurrent validity study 120 Knight, Baker, and Minder HORN, J. L., ti CATTELL, R. B. (1966). Refinement and test ...
PERM-GUARD: Authenticating the Validity of Flow Rules in Software Defined Networking
Light's retention scale: Does it have content validity? Psychology in the Schools Volurnp 21. Ocroher. 1984 LIGHT’S RETENTION SCALE: DOES IT HAVE CONTENT VALIDITY? STANLEY F. VASA, FREDERICK ...
一个用于检查欧洲增值税代码有效性的小型 Java 程序。 它通过调用 web 服务 http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl 查看源代码将 .jar 重命名为 .zip 并打开它运行:java -jar check_
vfs495:适用于Linux的Validity VFS495(138a:003f)驱动程序和实用程序
jQuery.validity 有效性不必手动编写验证或平衡某些笨拙的服务器端框架,而使您可以以自然而直接的方式设计客户端验证。 jQuery.validity易于学习和使用。 它完全适用于简单的验证方案,但它也设计用于干净自然地...
有效性指纹传感器驱动程序。 目录 python-有效性 配置 错误情况 列出设备失败 启动时出错 从挂起唤醒后指纹不工作 启用指纹以进行系统身份验证 pam-auth-update 的实际变化 ...更多详情、使用方法,请下载后细读README...
主要介绍了jquery内置验证(validate)使用方法示例,在做表单验证的时候可以用到,下面看代码使用方法
The digit naming speed test: Its power and incremental validity in identifying children with specific reading disabilities Assessing Severity in Behavior Disorders 15 S~HACHAR, R., RUITER, M., & ...
驱动程序,hp的elitebook 系列指纹驱动程序!
Validity . define @ , name : ' required ' email : { regex : / . + \@ . + \. . + / } age : [ ' number ' , { greaterThan : 0 }] zipcode : [ ' required ' , { length : 5 }] person = new Pe
language testing 权威刊物文章 可供语言测试与学习者使用。
讲述计算机算术和有效性理论、实现和应用,是计算机系统结构的必备知识
Standardization of a scale for the study of children's learning styles: Structure, stability, and criterion validity Psychology in rhe Schools Volume 21, January. 1984 STANDARDIZATION O F A SCALE...