Abstract

AbstractTypes in programming languages cannot model many properties of real world objects and quantities. Consequently, many errors resulting from the inconsistent usage of program objects representing real world objects and quantities cannot be detected automatically. For example, the real variables PRICE and WEIGHT, representing the price of diesel fuel and the weight of a person, may be inadvertently added, giving a non‐sensical value; such an error cannot be detected by a compiler. The programming language Ada introduces the concept of derived types to tackle this problem. An alternative solution to this problem is the incorporation of units of measure as a new data attribute. Derived types only partially solve the problem of detecting the inconsistent usage of objects; some valid usages of objects are also not allowed. Moreover, the solution is inelegant and inconvenient to use. On the other hand, specification of units of measure solves the problem elegantly and conveniently. The two solutions are compared and analysed. Several ways to implement units of measure in Ada are examined.

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call