A validator is a method for validating data while saving an element’s model. This article will consider the data validation process and its main techniques.
The purpose of data validation
When exchanging data between different information systems, sometimes it becomes necessary to check data for compliance with certain criteria. For example, it can be checked for types, value ranges, fields filled, correct relationships between several models, and more. Although, on the one hand, validation is an additional cost of time and resources, on the other hand, it can significantly reduce the time for subsequent debugging and verification when modifying the exchange.
Validation occurs when it is impossible to assess the conformity of a product, process, or system to customer requirements before the customer starts using the product. For example, if we are talking about software, validation code is built into it. The customer enters this code if the product meets their expectations and performs the necessary tasks. Otherwise, the product’s access is terminated, its improvements are carried out, or the contractor returns the money.
How to validate data?
Wherever validation is performed, it can be done in several different ways, depending on what constraints are placed on the data:
- Character check. As a rule, such reviews are performed in the user interface as data is entered.
- Control of individual values. For the user interface, it is a check of the value in a separate field, and it can be performed both as you type and after the input is completed, when the field loses focus. For a program interface (API), this is a test of one of the parameters passed to the called procedure. It is a check of some read fragments of the file for data received from a file.
- The set of input values. It can be assumed that some data is first transferred to the program, after which some signal is given that initiates their processing. For the program interface, this type of validation involves checking the set of input parameters of the called procedure; for the case of receiving data from a file, this is a check of all read data.
- Checking the state of the system after data processing. Finally, there is the last way you can resort to if the input data validation fails – you can try to process them but leave the opportunity to return everything to its original state. Such a mechanism is often called transactional.
A transaction is a sequence of actions that either all complete successfully or some failure occurs when performing a single step. So, validation can be performed during the execution of the transaction, and the last check can be performed at the very end of the data processing transaction. At the same time, we are no longer validating the data itself but the state that turned out after they were completely processed. If this state does not satisfy some restrictions, we recognize the input data as invalid and return everything to its original form.
Who does the validation?
If the company is large, its structure often has a special quality management department, which organizes the validation process. The second option is to attract third-party specialists from specialized firms. In both cases, let’s pay attention to the fact that the task of employees is precisely the organization.
The work as a whole is headed either by the head of the organization or the direction director. He sets goals, allocates material and financial resources, and controls the result. Next, quality management specialists identify processes and products that need validation.