...
Code Block | ||
---|---|---|
| ||
if(age>=18) { printf("Of legal voting age"takevote(personID); } /*Various Processing code*/ if (age<=18) { checkSchoolEnrollment(personID); } |
Compliant Code:
Code Block | ||
---|---|---|
| ||
if(age>=VOTINGADULT_AGE) { printf("Of legal voting age"takevote(personID); } /*Various Processing code*/ if (age<=ADULT_AGE) { checkSchoolEnrollment(personID); } Â |
In the compliant code it is easy to check if the user is an adult and process accordingly. If the definition of adult changes during iterations of the codebase it is much simpler to replace the value for ADULT_AGE then search for instance of 18 and see if they're appropriate for change.
Risk Assessment
Mistakes regarding numeric values can cause unintended consequences if changes are not made uniformly
...