units of measure : Java Glossary


units of measure
One of the most common errors in engineering programming is making invalid assumptions about the units of measure of a variable. Is the force measured in newtons or pounds? If the units of measure were explicitly stated, then dimensionality consistency checks could automatically be done on assignment and expressions. You can’t assign a variable measured in kiloPascals to one measured in joules. You can’t add seconds to kilograms. The compiler could even put in conversion factors when the units don’t quite match, so long as the dimensionality is correct, e. g. assign a miles/hour value to a km/hour variable, or perhaps even a miles/gallon value to a liters/km variable.

What is dimensionality? You can think of any unit of measure as distanced x massm x timet for some positive or negative integers d, m and t. For example speed = distance × time-1. The dimensionality of a unit of measure is that tuple: d, m and t.

The same notion can apply to units of measure in business programming, e.g. does variable size measure rows or columns? It is dangerous to get it backwards. If the units of measure were formally declared, the compiler could catch you if you used the variable in the wrong context.

Some people have suggested piggybacking a scheme for checking units of measure atop Java. Others want to go further and have automatic conversions applied.

Learning More


This page is posted
on the web at:

http://mindprod.com/jgloss/unitsofmeasure.html

Optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\jgloss\unitsofmeasure.html
logo
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.
Blog
IP:[65.110.21.43]
Your face IP:[50.17.27.205]
You are visitor number