Range (analysis pattern)

from Wikipedia, the free encyclopedia

Range ( English for "range, interval, limit") is an analysis pattern developed by Martin Fowler for software technology .

method

As a model for software technology , Range specializes in a defined state of affairs and is used to model value ranges. It is used in the conception of new software and is not used for direct programming, but as a standardized sample for checking, analyzing and displaying the “range of values”. The derivation of the source code during the later concrete creation of the application software is simplified by the specialization and the sample character.

commitment

In principle, this pattern can be used to create a range between any two sizes. The only requirement is that the sizes support the comparison operations <, >, =, <=, and >=(or equivalents for the respective data type ).

When dealing with value ranges (such as 10-15), the range alone is only used as a related object without any further meaning. Only in connection with other analysis models does the range unfold its full functionality and can do a lot more. Range is often used in conjunction with Quantity or Measurement . Quantity represents the individual values ​​including their units, measurement is used to model (possibly several) quantitative measurements for an object. Without a range, these analysis patterns provide an insight into individual, individual values ​​that provide a quantitative statement, but are not related and have no further meaningfulness. In order to analyze the total amount of values ​​and to be able to classify them, it makes sense to group them into categories. Range is used here; the division and assessment of the values ​​is the task of Range by providing ranges of values ​​(categories): For example, sales in bandwidths or all measurements that are below any threshold. This makes it possible to analyze whether values ​​are within their permitted tolerances and, depending on the category or classification of the result, different reactions can be made.

Martin Fowler says about quantity and range: “ These a small fundamental patterns, yet ones that are used pretty widely. If you write OO systems they should be an ever-present part of your toolkit. “So these two patterns are integral parts of software development.

A further link and use with the observation pattern is also possible in order to be able to categorize and classify the values ​​during their observation.

Use and application

To use the pattern, the first step is to define and delimit the various value ranges so that all values ​​can be clearly assigned. The first thing to think about for areas is the definition of a lower and upper limit that must match the type of the respective data element. Numbers (1 ... 10), date (01/01/2000 to 01/31/2000), but also strings (like AAA ... AZZZ) can be used. Ranges can include more information than just a range restricted by upper and lower limits. There can be overlapping and contiguous intervals, or several intervals can together form a contiguous area. Furthermore, open-ended areas are also required in certain areas of application, for example "less than 6 months". Operations for dealing with ranges must also be available, for example to assess whether values ​​belong in a special area or to be able to compare areas. This supports the range pattern.

The ABAP programming language explicitly supports ranges.

example

In the simplest case (for the upper and lower limit) the range can be represented as follows:

Analysis pattern range (simple)

For the additional information mentioned above and to support the full functionality (mentioned in the next paragraph), the illustration looks like this:

Analysis pattern range (complex)

Functions

A range therefore contains all information that is important for an area:

  • What does it contain, as well as an "Includes" operation to check whether a value belongs in the range object
  • What does the range overlap with; Contains the range of other / smaller ranges (to use partial ranges) as well as the operations necessary to carry out these comparisons
  • What does the range adjoin, as well as the necessary operation for range comparison
  • Support of sorting criteria and provision of a sorting function to determine a ranking of the values
  • The affected variables (e.g. time, age, ...)
  • Which values ​​of the sizes can be used in the range at all (validity range)
  • Upper and lower limit of the values ​​(must be in the area of ​​validity; limits are also optional to represent unlimited areas)
  • Information on differentiating the use cases "less than x" and "less than or equal to x" ( Boolean values )

See also

  • Analysis pattern , a general overview of other analysis patterns
  • Quantity , an analysis pattern that can be used for Range for the joint storage of values ​​with their associated units
  • Measurement , an analysis pattern for measurements that can be used for Range

literature

  • Martin Fowler: Analysis Patterns . Addison-Wesley, Amsterdam 1996, ISBN 0-201-89542-0 .

Web links