注:数据证实可包括格式检验、完整性检验、检验键测试、合理性检验和范围检验。
Note: Data validation may include format checks, completeness checks, check key tests, reasonableness checks and limit checks.
那就是说,如果函数有确定的有效值集合或范围可作为参数,可以将检验参数是否有效的断言放在该函数代码的第一行。
That is, if a function has a certain set or range of valid values for its arguments, an assertion to this effect can be placed as the first line of code in the function.
转换和验证使您可以侧重于业务逻辑,而不是侧重于对输入数据进行繁琐的资格认定,比如null检验、长度限定、范围边界,等等。
Conversion and validation allow you to focus on business logic rather than the tedious qualifications of input data such as null checks, length qualifiers, range boundaries, etc.
应用推荐