Dynamic Scales

Dynamic scales are scales whose levels use measures instead of absolute bounds. They are useful when one metric has a different meaning according to the context in which it is read. In software development for example, you may accept a certain amount of specification changes at one stage of the process, but completely want to prohibit it at another stage. This section takes you through an example that can be implemented easily in your model with the use of dynamic scales.

What we want to guarantee with our dynamic scale, is that during three different phases of development, our requirements stability indicator is evaluated differently, as represented below:

Requirement Stability by Development Phase.

The following is an example of a dynamic scale definition for a KPI that evaluates the stability of requirements as excellent, fine, worrying, critical or unknown:

<Scale scaleId="DYN_SCALE_REQ_STABILITY" isDynamic="true">
    <ScaleLevel levelId="DYN_EXCELLENT" bounds="[APP(EXCELLENT_THRESHOLD);["  rank="0" />
    <ScaleLevel levelId="DYN_FINE" bounds="[APP(FINE_THRESHOLD);APP(EXCELLENT_THRESHOLD)[" rank="1" />
    <ScaleLevel levelId="DYN_WORRYING" bounds="[APP(WORRYING_THRESHOLD);APP(FINE_THRESHOLD)[" rank="2" />
    <ScaleLevel levelId="DYN_CRITICAL" bounds="[APP(CRITICAL_THRESHOLD);APP(WORRYING_THRESHOLD)[" rank="3" />
    <ScaleLevel levelId="DYN_UNKNOWN" bounds="];APP(CRITICAL_THRESHOLD)[" rank="4" />
</Scale>

Note

Only measureId or APP(measureId) are allowed in the bounds attribute.

Compared with the examples of scales shown in the section called “Scales”, note the use of the isDynamic attribute and how the bounds are expressed with measures instead of actual values.

The threshold measures can vary for each analysis and/or for each artefact type, and the scale may therefore be different as time goes by. There are two ways they could be set:

  1. By using attributes at application levels so that users define the values of the thresholds manually.

  2. By computing the thresholds during the analysis with IF(), CASE() or other available functions described in the section called “Functions”

Here is an example setting the thresholds according to a PHASE attribute set by the user before running an analysis (more information about attributes is available in the section called “Attributes”:

<!-- Attribute Definition in Wizard -->
<tag type="multipleChoice" name="Development Phase: " measureId="PHASE"
	defaultValue="SPECIFICATION" displayType="radioButton"
	targetArtefactTypes="APPLICATION">
	<value key="SPECIFICATION" value="1" />
	<value key="PROTOTYPING" value="2" />
	<value key="IMPLEMENTATION" value="3" />
</tag>

<!-- Metrics Definition in Analysis Model -->
<Measure measureId="PHASE" targetArtefactTypes="APPLICATION" defaultValue="0" />
<Constant id="PHASE_SPECIFICATION" value="1" />
<Constant id="PHASE_PROTOTYPING" value="2" />
<Constant id="PHASE_IMPLEMENTATION" value="3" />

<!-- Thresholds Computation in Analysis Model -->
<Measure measureId="EXCELLENT_THRESHOLD">
	<Computation targetArtefactTypes="APPLICATION" 
					result="CASE(PHASE,
	                        	 C.PHASE_SPECIFICATION:60,
	                        	 C.PHASE_PROTOTYPING:95,
	                        	 C.PHASE_IMPLEMENTATION:100,
	                        	 DEFAULT:-1)"/>
</Measure>
<Measure measureId="FINE_THRESHOLD">
	<Computation targetArtefactTypes="APPLICATION" 
					result="CASE(PHASE,
	                        	 C.PHASE_SPECIFICATION:30,
	                          	 C.PHASE_PROTOTYPING:80,
	                          	 C.PHASE_IMPLEMENTATION:99,
	                         	 DEFAULT:-1)"/>
</Measure>
<Measure measureId="WORRYING_THRESHOLD">
	<Computation targetArtefactTypes="APPLICATION" 
					result="CASE(PHASE,
	                        	 C.PHASE_SPECIFICATION:10,
	                             C.PHASE_PROTOTYPING:40,
	                             C.PHASE_IMPLEMENTATION:95,
	                             DEFAULT:-1)"/>
</Measure>
<Measure measureId="CRITICAL_THRESHOLD">
	<Computation targetArtefactTypes="APPLICATION"
					result="CASE(PHASE,
	                        	 C.PHASE_SPECIFICATION:0,
	                             C.PHASE_PROTOTYPING:20,
	                             C.PHASE_IMPLEMENTATION:90,
	                             DEFAULT:-1)"/>
</Measure>

The final REQUIREMENTS_STABILITY indicator is associated with a static scale that uses the same ranks as the dynamic one, and its value is assigned by retrieving the desired rank from the dynamic scale using the FIND_RANK() function:

<!-- Static scale to base the KPI on -->

<Scale scaleId="SCALE_REQ_STABILITY">
    <ScaleLevel levelId="EXCELLENT" bounds="[0;0]"  rank="0" />
    <ScaleLevel levelId="FINE" bounds="[1;1]" rank="1" />
    <ScaleLevel levelId="WORRYING" bounds="[2;2]" rank="2" />
    <ScaleLevel levelId="CRITICAL" bounds="[3;3]" rank="3" />
    <ScaleLevel levelId="UNKNOWN" bounds="[4;4]" rank="4" />
</Scale>

<!-- Indicator definition -->
<Indicator indicatorId="REQUIREMENTS_STABILITY" 
			measureId="REQ_STABILITY_RANK" 
			targetArtefactTypes="APPLICATION;FOLDER;FILE"
			scaleId="SCALE_REQ_STABILITY" />

<!-- The base measure that holds the actual raw value of Requirement Stability -->
<Measure measureId="REQUIREMENTS_STABILITY_METRIC"
		 targetArtefactTypes="APPLICATION;FOLDER;FILE" defaultValue="0" />

<!-- A temporary measure to compute the rank of the metric on the dynamic scale -->
<Measure measureId="REQ_STABILITY_RANK">
	<Computation stored="false" targetArtefactTypes="APPLICATION;FOLDER;FILE"
			 result="FIND_RANK(DYN_SCALE_REQ_STABILITY, REQUIREMENTS_STABILITY_METRIC)" />
</Measure>

For more information about the FIND_RANK() function, refer to the section called “Functions”.

Tip

When using dynamic scales, the scale and measure computed for an indicator may not make sense for the end user. In this case, you may want to change what the user sees via the use of the displayedScale and displayedMeasure attributes in your indicator definition. For more information about this syntax, consult the section called “Indicators”.