Dimiensioned Measurement

  • Thread starter Thread starter Eric NY
  • Start date Start date
E

Eric NY

There is now a robust java solution I've been reading about called jscience
(http://jscience.org). Is anyone aware of a similar effort in the .net
community? The library supports consistent handling of measurement and
conversion between quantities of the same dimension in just about every
international standard (SI) and non-SI unit of measurement in such a way
that the compiler facilitates design time checking.

I'm in need of a few quantity types to deal with some common dimensions of
measurement in business, with Money being at the top of the list, and
Duration &
Length following. Barring an effort along the lines of jscience, any links
to code samples that do this would be much appreciated.

TIA
Eric
 
Eric said:
There is now a robust java solution I've been reading about called jscience
(http://jscience.org). Is anyone aware of a similar effort in the .net
community? The library supports consistent handling of measurement and
conversion between quantities of the same dimension in just about every
international standard (SI) and non-SI unit of measurement in such a way
that the compiler facilitates design time checking.

I'm in need of a few quantity types to deal with some common dimensions of
measurement in business, with Money being at the top of the list, and
Duration &
Length following. Barring an effort along the lines of jscience, any links
to code samples that do this would be much appreciated.
Just write your application in Java!

Oh, wait, I just saw what group I'm in. My apologies. :-)

There's no particular reason you can't just ape what the Java folks are
doing. Java and C# are about on par now as far as support for genericity is
concerned (minor, niggling flamewars of epic proportion concerning the
implementation aside).

So when the Java library does

public interface Measurable<Q extends Quantity> extends
java.lang.Comparable<Measurable<Q>>

This maps one-to-one to the C# declaration

public interface IMeasurable<Q> : IComparable<IMeasurable<Q>> where Q :
IQuantity

And so on, and so forth. Of course, the interesting stuff (the
implementation behind all the type-enforced quantities) you don't get for
free, but the interfaces are certainly straightforward to st... borrow. The
library is distributed under the BSD license, so you don't even have to make
the stuff you st... borrow open. C# and Java are very close to each other in
terms of syntax, so you could just pick and choose the classes and methods
you need for your application and convert them to C#. This shouldn't take
too much effort.

Conceivably, you could easily have an NScience to go along with JScience,
much like with Log4J and Log4Net.
 
Back
Top