Problem – Describing Semantically Meaningful Type Conversions
Many times one entity must be able to stand in for another entity. In such instances a type conversion is necessary that makes the stand-in appear to be of the same as the desired type.
Type conversions may be accomplished through declaration of type hierarchy mappings. The assumption of this business rule pattern is that some common shared ancestry between two types exists. Thus, all common attributes are compatible by type membership. Each of the remaining differences is decomposed until only primitive attribute types remain. A mapping between related attributes may be either one-to-one or one-to-many. Conversion algorithms are introduced if necessary by applying the Derivation Algorithm rule pattern.
In most cases a loss of information occurs, but the outcome may be sufficient for the intended purposes. For example, an attribute declared as a float loses precision if converted to an integer, but either representation may be sufficient for intended use in a calculation that would have rounded the number anyway. Therefore some measure of the tolerance of fidelity of the information can be indicated as part of the type conversion rule. If one considers image file formats, some formats such as PICT and TIFF are lossless representations of the original uncompressed bitmap. However, other compression formats make approximations for how the image is constructed, such as in the AVI and MPEG motion picture formats.
|Conversion Mapping Source||Residential|
|Conversion Mapping Target||Commercial|
|Mapping||Commercial.squareFootage = sum(room.length x room.width)|
Previous | Table of Contents | Next