Java Glossary : units of measure

CMP home Java glossary home Menu no menu Last updated 2004-06-28 by Roedy Green ©1996-2004 Canadian Mind Products

Java definitions: 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

You are here : home : Java Glossary : U words : units of measure.

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 x 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 logo
CMP_home
home
Canadian Mind Products CSS
HTML Checked!
ICRA ratings logo
mindprod.com IP:[24.87.56.253]
Your IP:[80.134.30.163]
You are visitor number 893.
Please send errors, omissions and suggestions
to improve this page to Roedy Green.
You can get a fresh copy of this page from: or possibly from your local J: drive mirror:
http://mindprod.com/jgloss/unitsofmeasure.html J:\mindprod\jgloss\unitsofmeasure.html