数据验证和验证有什么区别? [英] What's the difference between data Validation and Verification?
问题描述
我从一位过去的雇主那里得到的回忆是,他们将两者区分如下:
My recollection from a past employer is that they distinguished between the two as follows:
- 验证是检查数据在非常基本的意义上是否合适的过程;例如,日期字段中的数据可以转换为日期,或者数字字段中的字符可以转换为适当类型的数字;
- 验证是根据您强加在界面上的其他一些业务"规则来检查输入的数据的过程 - 例如,出生日期字段指示特定年龄范围内的申请人.
这些记忆与关于该主题的维基百科文章无关,也与
These memories do not tie in with the Wikipedia article on the subject, nor a BBC BiteSize Revision article.
那么共识是什么:例如,当我检查 Xml 输入时,人们是否关心调用了哪些方法和进程?
So what is the consensus: Do people care what methods and processes are called when I am checking Xml inputs for example?
我在做什么时:
- 检查日期字段是否包含可转换为 C# 日期时间的字符;
- 检查 DateTime 是否在要存储在 SQL Server 中的适当日期范围内;
- 检查出生日期是否表明客户超过 18 岁但未满 65 岁?
推荐答案
好的,所以我将把它作为一个公开的邀请来思考......
Ok, so I'll take this as an open invitation to musing...
我认为区别很像编译时错误与运行时错误.就像编译器能够判断两个变量 a
,b
的类型是 double
一样,因此表达式 a/b
是有效的,只有在运行时 DivideByZeroException
可能会在 b
结果为 0
时引发.
I think the difference is very much like compile-time vs. runtime errors. Just like the compiler is able to tell that two variables a
,b
are of type double
, and thus the expression a/b
is valid, it is only during runtime a DivideByZeroException
may be raised if b
turns out to be 0
.
所以为了完成类比,我们可以验证一个字符串看起来像信用卡号('编译时间'),但只有在尝试向信用卡收费时才能验证它对应于一张有效的卡('运行时') 与金额
So to complete the analogy, one can validate that a string looks like a credit card number ('compile time'), but can only verify that it corresponds to a valid card only if one tries to charge the credit card ('runtime') with an amount
呸.所以我想我和你的老公司一样理解它.
Duh. So I guess I understand it pretty much like you old company does.
这篇关于数据验证和验证有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!