Wave
Probably an overkill way of modelling wavelength/frequency, but allows us to model it without worrying about which to use.
Interface
The published properties would be:
-
Frequency
: Hz (real)
-
Wavelength
: meters (real)
Implementation
This looks like a very simple object. Obviously we don't need to store both Frequency and Wavelength internally.
I think it makes sense for a Wave to be immutable (ie it can only be created with a set of characteristics, and thereafter is 'readonly'). The properties are all interdependent, so changing one without the other does not make sense.
--
MartinHill - 21 May 2004