units of measure : Java Glossary

go to home page U words local find full screen, hide local find menu Google search web for more information on this topic jump to foot of page translate this page with Babelfish punctuation 0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z (all) ©1996-2009 2007-10-29 Roedy Green, Canadian Mind Products
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.


CMP homejump to top You can get the freshest copy of this page from: or possibly from your local J: drive (Java virtual drive/mindprod.com website mirror)
http://mindprod.com/jgloss/unitsofmeasure.html J:\mindprod\jgloss\unitsofmeasure.html
CMP logofeedback Please email your feedback for publication, errors, omissions, typos, formatting errors, ambiguities, unclear wording, broken/redirected link reports, suggestions to improve this page or comments to Roedy Green : feedback email
mindprod.com IP:[65.110.21.43]
view BlogYour face IP:[38.107.191.108]
You are visitor number 10,018.