Verification and Validation: Concepts and Applications | 验证与校验:概念辨析与应用

📚 Verification and Validation: Concepts and Applications | 验证与校验:概念辨析与应用

In computer science, verification and validation are two essential quality assurance processes that are often confused. They both aim to improve software quality, but they address different questions and are used at different stages of development.

在计算机科学中,验证与校验是两个至关重要的质量保证过程,经常被混淆。它们都旨在提高软件质量,但关注的问题不同,并且在开发的不同阶段使用。


1. What Are Verification and Validation? | 什么是验证与校验?

Verification is the process of checking that a product, service, or system meets its specified requirements. It answers the question: ‘Are we building the product right?’

验证是检查产品、服务或系统是否满足其规定要求的过程。它回答的问题是:”我们是否正确地构建了产品?”

Validation is the process of checking that the final product actually satisfies the user’s needs and intended purpose. It answers the question: ‘Are we building the right product?’

校验是检查最终产品是否实际满足用户需求和预期目的的过程。它回答的问题是:”我们是否构建了正确的产品?”

In the context of data entry, verification and validation have more specific meanings. Verification checks that the data entered matches the original source, while validation checks that the data is reasonable and within acceptable bounds.

在数据录入的语境中,验证与校验具有更具体的含义。验证检查输入的数据是否与原始来源一致,而校验检查数据是否合理且在可接受范围内。


2. Key Differences | 主要区别

The main difference lies in the reference point. Verification uses the requirements specification as the reference, while validation uses the user’s real-world expectations as the reference.

主要区别在于参考点。验证以需求规格说明书为参考,而校验以用户在真实世界中的期望为参考。

  • Verification checks consistency, completeness, and correctness of internal implementation.

    验证检查内部实现的一致性、完整性和正确性。

  • Validation checks whether the product is useful and acceptable to end users.

    校验检查产品对最终用户是否有用且可接受。

  • Verification is often performed by the development team through reviews, walkthroughs, and static analysis.

    验证通常由开发团队通过评审、走查和静态分析执行。

  • Validation often involves the client or users through acceptance testing, beta testing, and usability testing.

    校验通常涉及客户或用户,通过验收测试、Beta测试和可用性测试执行。

Using the popular comparison: Verification ensures the product is built according to the design; Validation ensures the design itself is what the user asked for.

用流行的对比来说:验证确保产品按照设计构建;校验确保设计本身是用户所要求的。


3. Verification Methods | 验证的方法

Verification methods include both static and dynamic techniques. Static verification does not involve executing the code, while dynamic verification involves running the program with test data.

验证方法包括静态和动态技术。静态验证不涉及执行代码,而动态验证涉及使用测试数据运行程序。

Common static verification techniques:

常见的静态验证技术:

  • Code review – examining source code to find mistakes.

    代码评审 – 检查源代码以发现错误。

  • Walkthrough – a step-by-step manual tracing of an algorithm.

    走查 – 逐步手动跟踪算法。

  • Desk checking – simulating program execution on paper.

    桌面检查 – 在纸上模拟程序执行。

  • Data verification – double entry to ensure typed data matches original source.

    数据验证 – 双重输入以确保输入数据与原始来源一致。

Dynamic verification includes unit testing and integration testing, where components are executed to check for expected behaviour.

动态验证包括单元测试和集成测试,在这些测试中执行组件以检查预期行为。

For example, a module that calculates a student’s average score can be unit-tested by feeding it a known set of marks and checking the output against a manually calculated result.

例如,一个计算学生平均分的模块可以通过输入一组已知分数并对照手动计算结果来测试输出,这就是单元测试。


4. Validation Methods | 校验的方法

Validation methods focus on user needs. They are usually performed after the system is complete or at the end of each increment.

校验方法侧重于用户需求。它们通常在系统完成后或每个增量结束时执行。

Common validation techniques:

常见的校验技术:

  • Acceptance testing – the client tests the system against agreed criteria.

    验收测试 – 客户端根据约定标准测试系统。

  • Beta testing – a group of end users try the product in a real environment.

    Beta测试 – 一组最终用户在真实环境中试用产品。

  • User acceptance testing (UAT) – ensures the workflow meets business needs.

    用户验收测试 – 确保工作流程满足业务需求。

  • Data validation – checking if input values are sensible, e.g. range checks, type checks, format checks.

    数据校验 – 检查输入值是否合理,例如范围检查、类型检查、格式检查。

It is important to note that in data entry, the term ‘validation’ is used for automatic checks that reject invalid data, while ‘verification’ is used to detect human transcription errors.

需要注意的是,在数据录入中,”校验”用于自动拒绝无效数据的检查,而”验证”用于检测人工转录错误。

For example, a hospital system may use a format check on a National Health Service number, which is a validation rule. A second nurse entering the patient’s details separately is a verification process.

例如,医院系统可能对国家医疗服务号码使用格式检查,这是校验规则。而由另一位护士再次输入患者详细信息则属于验证过程。


5. Worked Example: Student Registration System | 实例分析:学生注册系统

Consider a student registration system. The requirement specification states that the system must accept a student ID as a 6-digit number.

考虑一个学生注册系统。需求规格说明规定系统必须接受6位数字的学生ID。

Verification: Check that the code correctly reads and stores the 6-digit number in the database. Unit tests can confirm the format is preserved.

验证:检查代码是否正确读取6位数字并将其存储在数据库中。单元测试可以确认格式被保留。

Validation: Ask the registrar (user) if the system actually makes their job easier and if all necessary fields are present. UAT is used to confirm the final system meets their needs.

校验:询问注册人员(用户)系统是否确实使他们的工作更轻松,以及所有必要字段是否都存在。使用UAT来确认最终系统满足他们的需求。

Additionally, for data input, a range check (1-999999) is a validation rule, while double-entry of the ID by two different people is a verification method.

此外,对于数据输入,范围检查(1-999999)是校验规则,而由两个不同的人重复输入ID是验证方法。

If the range check rejects 0000000, it is performing validation because the value is outside the acceptable set. If one typist enters 123456 and another enters 123457, the system detects a mismatch; this is verification.

如果范围检查拒绝0000000,这是因为该值超出可接受集合,属于校验。如果一位录入员输入123456,另一位输入123457,系统检测到不匹配;这属于验证。


6. Verification in Data Transfer | 数据传输中的验证

In data communication, verification ensures that data has not been corrupted during transmission. Checks such as checksums, parity bits, and echo checking are used.

在数据通信中,验证确保数据在传输过程中未被破坏。使用校验和、奇偶校验位和回显检查等检查方法。

For example, a checksum is calculated before sending and recalculated after receiving. If the two values match, the data is considered verified.

例如,在发送前计算校验和,在接收后重新计算。如果两个值匹配,则认为数据已验证。

Parity checks are another common verification method. A parity bit is added to a binary sequence so that the total number of 1s is even (even parity) or odd (odd parity).

奇偶校验是另一种常见的验证方法。一个奇偶校验位被添加到二进制序列中,使1的总数为偶数(偶校验)或奇数(奇校验)。

This type of verification does not check whether the data is meaningful or logical; it only checks transmission accuracy.

这种类型的验证不检查数据是否有意义或符合逻辑;它只检查传输的准确性。


7. Validation Rules in Databases | 数据库中的校验规则

Database systems use validation rules to prevent invalid data from being entered. Common rules include:

数据库系统使用校验规则来防止无效数据被输入。常见规则包括:

  • Range check – value must be within a specified range.

    范围检查 – 值必须在指定范围内。

  • Type check – data must be of a particular data type.

    类型检查 – 数据必须是特定的数据类型。

  • Format check – data must follow a pattern (e.g., email address).

    格式检查 – 数据必须遵循某种模式(例如电子邮件地址)。

  • Presence check – a field cannot be left blank.

    存在性检查 – 字段不能留空。

  • Length check – input must have a specific number of characters.

    长度检查 – 输入必须具有特定数量的字符。

  • Check digit – an extra digit calculated from the other digits to detect errors.

    校验位 – 根据其他数字计算出的额外数字,用于检测错误。

These are validation checks because they enforce rules about what data is reasonable, not whether the user intended to type it.

这些是校验检查,因为它们强制执行关于什么数据是合理的规则,而不是用户是否打算输入它。

For example, an online form asking for a date of birth might reject 31/02/2024 because there is no such date. This is a range/format validation, not a verification of the user’s birthday itself.

例如,一个要求输入出生日期的在线表单可能会拒绝31

Published by TutorHao | Computer Science Revision Series | aleveler.com

更多咨询请联系16621398022(同微信)

Comments

屏轩国际教育cambridge primary/secondary checkpoint, cat4, ukiset,ukcat,igcse,alevel,PAT,STEP,MAT, ibdp,ap,ssat,sat,sat2课程辅导,国外大学本科硕士研究生博士课程论文辅导

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from aleveler.com

Subscribe now to keep reading and get access to the full archive.

Continue reading