6

My recollection from a past employer is that they distinguished between the two as follows:

  • Validation is the process of checking that the data is appropriate in a very basic sense; for example that data in a date field can be converted to a date, or that characters in a number field can be converted to a number of the appropriate type;
  • Verification is the process of checking the typed data against some other 'business' rules that you impose on your interface - for example that the Date Of Birth field indicates an applicant within a certain age range.

These memories do not tie in with the Wikipedia article on the subject, nor a BBC BiteSize Revision article.

So what is the consensus: Do people care what methods and processes are called when I am checking Xml inputs for example?

What am I doing when I:

  1. Check that a date field contains characters that are convertible to a C# DateTime;
  2. Check that the DateTime is in an appropriate date range to be stored in SQL Server;
  3. Check that the Date Of Birth indicates a customer over 18 but under 65?
casperOne
  • 73,706
  • 19
  • 184
  • 253
Nij
  • 2,028
  • 2
  • 22
  • 27

3 Answers3

3

In my vocabulary, validation is checking whether the format of the data is correct, IE if a you're actually dealing with a correctly formatted date string . Verification is checking whether the date you got is actually the date you were expecting.

Rik
  • 28,507
  • 14
  • 48
  • 67
  • 1
    When you say that you got a date you were expecting, how do you know what to expect? Would you side on the BBC definition above, which suggests Verification is the process of repeating inputs and cross-checking them? – Nij Apr 16 '11 at 06:38
  • @Nij The BBC article is specifically written for the UK GCSE (high-school exams set at age 16) syllabus - _it's a given_ that current industry terms will differ from mainstream education to some extent; however given your question re dates specifically, the _validation_ step would be "is this string of user-input text a date value within a specific _sanity-check range_ (e.g. year 2000 to 2100)?" (and these checks are meant to be _fast and synchronous_) - while the _verification_ step involves more heavy-lifting and checks more than just static invariants. – Dai Dec 14 '21 at 05:07
2

Ok, so I'll take this as an open invitation to musing...

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.

bottlenecked
  • 2,079
  • 2
  • 21
  • 32
  • OK - so I selected your answer because you agreed with me :) How else to select a discussion question's answer? – Nij Apr 16 '11 at 06:35
  • @Nij True. Only those who tell you what you want to hear can really understand you after all :P Anyway, if forum like discussion was what some of us were hoping for... it never happened. 3 answers only. Too bad :( – bottlenecked Apr 16 '11 at 07:29
0

in terms of programming it makes no difference what you call it (validation or verification) but where you put the logic is important. usually all three rules you mentioned are known to be validations with first two points corresponding to UI validation and last point to business rule validation. we usually validate UI fields using dataannotations in our controller and Business rule validation is performed within business layer. But the bottom line from software point of view is; don't do an operation (save, edit) unless data is good (you call it valid or verified).

Muhammad Adeel Zahid
  • 17,474
  • 14
  • 90
  • 155
  • I guess part of my question was intended to find out if others _would_ consider it important what I called it! Sometimes you have to load data even if it is invalid; but not to your live tables hopefully! – Nij Apr 16 '11 at 06:32