Measurement (analysis sample)
Measurement (English for measurement is) an analysis sample from the software technique for modeling quantitative measurements on an object. The pattern was developed by Martin Fowler in a project for the National Health Service to model the health system and was first described in his book Analysis Patterns in 1996 .
problem
When mapping information about objects in the real world, there are basically two different options in object-oriented software technology. On the one hand, the information can be stored as an attribute in the form of a simple data type; on the other hand, it can also be stored as an association in the form of a referenced object.
The mapping of values is carried out in many software systems assuming a certain unit, e.g. B. the height as an integer with the value 185. Correctly interpreted, the person is 185 cm, i.e. 1.85 m tall. If adjustments are made to the system later, possibly in a country like the USA, which does not follow the definitions of the international system of units , semantic misinterpretations can occur. Furthermore, conversions from centimeters to meters are not described in a central location and must therefore be implemented by auxiliary methods of the object.
With this in mind, Martin Fowler developed the quantity pattern. The related mapping of value and unity of the pattern creates semantic clarity and solves many problems of interpretation, as well as the conversion of values. However, if there are several measurements for an object, several attributes would have to be created in the object in the form of references using Quantity, which would unnecessarily inflate the respective class. It is also not possible to map measurement-specific data without expanding the model.
context
In a project for the National Health Service , Fowler was part of a project team made up of doctors, nurses and analysts and was entrusted with the task of creating a system for mapping the health care system from a clinical perspective. His considerations and examples therefore have their origin in medical measurements, which, however, have been developed into more general solutions (see Motivation of Patterns ).
The observation that a large number of measurements occur and should be mapped for an object in certain surroundings prompted Fowler to develop the analysis pattern Measurement . In his example, the object is a patient on whom different measurements are being made.
Powers
Fowler finally introduces the measurement pattern in his book Analysis Patterns on the development of the pattern quantity , conversion ratio , and compound units . The description includes the introduction of the pattern Knowledge Level and the pattern-like structure Phenomenon Type . In further sections, the measurement pattern is supplemented and further developed to include qualitative information in the form of the observation pattern.
solution
A reference to objects of the Measurement class is defined for an object ( Person class ) . The objects of the Measurement class map the individual measurements using an object of the Quantity class and supplement them with measurement-specific information. Furthermore, for each object of the Measurement class, an object of the Phenomenon Type class is referenced that typifies the measurement.
The breakdown into knowledge level and operational level does justice to the nature of the data recorded. Objects of the knowledge level change less often than objects of the operational level . The Knowledge Level certain extent describes the behavior of objects.
example
A patient is shown as a person. Several heart rate and blood pressure measurements were taken and recorded in the system for this patient:
date | Measurand | value | unit | Specialty |
---|---|---|---|---|
January 1st | Heart rate | 80 | Beats per minute | no |
January 1st | Blood pressure | 105 | Millimeters of mercury | no |
January 2nd | Heart rate | 85 | Beats per minute | Self-measurement |
January 2nd | Blood pressure | 110 | Millimeters of mercury | Self-measurement |
January 3rd | Heart rate | 75 | Beats per minute | no |
January 3rd | Blood pressure | 103 | Millimeters of mercury | no |
This creates a person object that references six measurement objects. These reference either the blood pressure or heart rate object of the Phenomenon Type and an object beats per minute or millimeters of mercury from Quantity (see also Compound Units ). The measurement objects still have the special feature as an attribute that the measurements were taken on January 2nd by the patient himself.
See also
- Analysis pattern , overview of known analysis patterns
- Phenomenon , used to typify the measurements
- Quantity , used for the coherent storage of a value with its unit
literature
- Martin Fowler: Analysis Patterns . Addison-Wesley, Amsterdam 1996, ISBN 0-201-89542-0 , pp. 35-55 .