| Activities | System | WEB pages | Company |
This library has a strictly physical purpose. That is, in handling physical measurements, there is a proliferation of units. This library handles the translation from one unit to another.
In each case, the information is kept internally in a particular unit. Each time the value is referenced, the unit must be given, so the internal representation is not that important.
In addition, operations are defined on the units, so that, for example, if a distance is divided by a time, the result is a velocity. The user doesn't need to worry about translating to the proper units to do the operation, then translating back. It's all done in the classes.
One design decision that needs to be kept in mind is based on the observation that time is really the fourth dimension according to Relativity. I've played with the Lorentz transformations enough to realize that time is, in fact, a true fourth dimension no different than the other three. Therefore, it is possible to measure time in feet, and distance in hours. The difference in the ranges of these units usually makes it desirable not to mix them too much, but measuring time in feet is reasonable for computer cycle times, and measuring distance in years is reasonable for measuring the distance between the stars.
Other methods for these units allow the unit to be set from a string (for example, from a text box), and allow the unit to be formatted in any unit. Also, the names of the units can be extracted.
There is an optional precision, which I am thinking about making mandatory. This keeps track of how accurate a measurement is. When they are used, the precision is kept accurate even through operations are performed on the units. Although this is used in some of the developed software, I'm not sure it has been kept up to date.
The classes are:
©2008, Baldwin Computer Science
About us | Legal | Careers | Contact us | Home4