What is an attribute domain?

The domain attribute is the concept of computer programming that refers to the valid range of values ​​allowed for a specific attribute in the program code. Entering the wrong value - the value outside the permitted range - often the program falls. The ideal method to ensure that the values ​​entered beyond the valid range are to provide the end user with a display message indicating the range of acceptable values, which reduces the risk that he or she enters unintentionally excessive value.

The variables are the core of the program code. When assigned, the variables are given a specific type. The integer is the type of variable used when only integers are allowed; The string on the other side accepts any combination of letters, numbers or characters. Deciding on the type of variable places the initial restriction to the domain of the item attribute. For example, the end user cannot successfully enter "ABCDE" into the integer value. This preliminary restriction on the attribute domain is firmly connected to the programming language so it cannot be changed or oneTent to coded software.

In addition to the type of variable, the programmer can place further restrictions in the attribute domain for a particular item. For example, if programming software for the hotel chain, the programmer naturally limits the range of values ​​for the "hotel room number" assignment of the number of hotel rooms in the building. If the room numbers go from 100 to 1,000, it only makes sense to limit the range of attributes of the variable corresponding to the way. This ensures that the program will not generate false results based on incorrectly entered data.

Once the programmer selects the attribute domain, it must program the error code to prevent software users unintentionally, or try to collapse the Entering Off-Rostah system. This is a simple routine that controls the input values ​​against the given attribute ranges. If the attribute falls within the range, the program is normally. If not, the program returns a simple message "Incorrect input" and attempts to again without allowing to fill in the variable until it is certain that the input value is to a specific extent.

IN OTHER LANGUAGES

Was this article helpful? Thanks for the feedback Thanks for the feedback

How can we help? How can we help?