Скачать презентацию The Software Design Metrics tool for the UML Скачать презентацию The Software Design Metrics tool for the UML

5c7bde55a6859a226a21596e5e7e905b.ppt

  • Количество слайдов: 40

The Software Design Metrics tool for the UML™ Last updated: 18 -Feb-2011 The Software Design Metrics tool for the UML™ Last updated: 18 -Feb-2011

UML Design Quality Measurement Calculate design metrics for UML designs, e. g. , Size UML Design Quality Measurement Calculate design metrics for UML designs, e. g. , Size of packages Complexity of classes Coupling between components Etc. Check UML design rules Detect incomplete, incorrect, redundant, or inconsistent design Find style problems such as circular dependencies, violation of naming conventions, and more

Design Properties: Coupling The degree to which an element in the design is connected Design Properties: Coupling The degree to which an element in the design is connected to other elements. Distinction: import coupling and export coupling Aka afferent/efferent coupling, fan-in/fan-out Impact of high coupling on system quality Decreased maintainability Decreased testability Decreased reliability Decreased reusability

Example Coupling Metrics Class coupling metrics Class used as parameter type of an operation Example Coupling Metrics Class coupling metrics Class used as parameter type of an operation Outgoing/incoming associations or dependencies Messages sent/received by instances of the class Package coupling metrics Associations or dependencies from or to classes/interfaces outside the package Component coupling metrics Required interfaces, provided interfaces

Design Properties: Size of a design element: the number or size of elements it Design Properties: Size of a design element: the number or size of elements it contains. Number of attributes, operations in a class Number of classes, interfaces, in a package Number of states in a state machine . . . Good indicators of effort Large elements indicate poor design E. g. “God” or “Blob” classes

Design Properties: Complexity The connectivity between the elements of a design unit (“count of Design Properties: Complexity The connectivity between the elements of a design unit (“count of the edges in a graph”) Number of transitions in a state chart Number of method calls between lifelines in a sequence/communication diagram Number of object/control flows in an activity diagram Impact of high complexity on system quality Decreased understandability, testability Increased fault-proneness

Further Examples of Metrics Class inheritance metrics Depth of the class in the inheritance Further Examples of Metrics Class inheritance metrics Depth of the class in the inheritance hierarchy Number of children or descendent classes The “Martin Metrics” for packages Abstraction (A), instability (I), distance from main sequence (D) Metrics for use cases Included or extended use cases Size of a use case in terms of the size of its sequence/activity diagrams

Design Rule Checking (1) Completeness Unused or unreachable elements Underspecified elements: unnamed, missing type, Design Rule Checking (1) Completeness Unused or unreachable elements Underspecified elements: unnamed, missing type, . . . Correctness Well-formedness rules of the UML E. g. , circular inheritance, fork state does not target orthogonal states, . . .

Design Rule Checking (2) Style Circular dependencies between classes/packages Controversial design practices, e. g. Design Rule Checking (2) Style Circular dependencies between classes/packages Controversial design practices, e. g. : Multiple inheritance Use of association classes, n-ary associations Big classes, long parameter lists Naming Conventions for capitalization, prefixes, . . . Use of programming language keywords, . . .

Benefits of Design Measurement Identify potential design problems early on Better focus of review Benefits of Design Measurement Identify potential design problems early on Better focus of review and testing efforts Increase system quality and quality assurance effectiveness Refine your LOC or effort estimates for implementation, testing, maintenance

From Model to Metrics with XMI (1) UML Tool (RSM, Magic. Draw, Together Designer, From Model to Metrics with XMI (1) UML Tool (RSM, Magic. Draw, Together Designer, Poseidon, . . . ) UML Model as XMI File

From Model to Metrics with XMI (2) XMI: XML Metadata Interchange Standardized by OMG; From Model to Metrics with XMI (2) XMI: XML Metadata Interchange Standardized by OMG; key technology of the MDA Supported by all major UML modeling tools XML-based representation of a UML Model Different versions of XMI: 1. 0/1. 1/1. 2/2. 0/2. 1 SDMetrics supports all versions of XMI Works with all modeling tools with XMI export Meta models for UML 1. x and UML 2. x

Metric Analysis: Table View Metric Analysis: Table View

Metric Analysis: Metric View Metric Analysis: Metric View

Metric Analysis: Element View Metric Analysis: Element View

Design Rule Checking Design Rule Checking

Design Comparisons Design Comparisons

Relation Matrices Relation Matrices

Data Export Detailed metric data analysis with statistical software packages or spreadsheets Export of Data Export Detailed metric data analysis with statistical software packages or spreadsheets Export of data tables HTML XML for Microsoft Excel Tab or comma-separated text files Open. Office. org Calc Export of graphs SVG, PNG, JPG

Summary of SDMetrics' Features Over 120 design metrics, 130 design rules Cover all diagram Summary of SDMetrics' Features Over 120 design metrics, 130 design rules Cover all diagram types of the UML Users can define new metrics and rules Works with all UML tools with XMI export Customizable XMI import Batch processing via command line interface Fast execution Analyses large designs with hundreds of thousands of model elements within seconds

Customizing SDMetrics User-defined UML meta models User-defined XMI import User-defined metrics and rules Customizing SDMetrics User-defined UML meta models User-defined XMI import User-defined metrics and rules

SDMetrics Project Files UML Modeling Tool XMI Source File XMI Transformation File SDMetrics Metamodel SDMetrics Project Files UML Modeling Tool XMI Source File XMI Transformation File SDMetrics Metamodel Definition File Metrics Definition File Metric Data Output

Meta Model Definition File Defines the model elements that SDMetrics knows: Attributes Meta classes Meta Model Definition File Defines the model elements that SDMetrics knows: Attributes Meta classes Relationships Defined as far as is needed for metric calculation and design rule checking Not a complete 1: 1 representation of the standard UML meta models Default meta models for UML 1. 3/1. 4 and UML 2. x

" src="https://present5.com/presentation/5c7bde55a6859a226a21596e5e7e905b/image-24.jpg" alt="Meta Model Definition File Sample " /> Meta Model Definition File Sample . . .

XMI Transformation File (1) How to retrieve information of the model elements and attributes XMI Transformation File (1) How to retrieve information of the model elements and attributes from XMI files Defines a mapping: UML meta model as manifested in the XMI file SDMetrics' simplified meta model

Excerpt from an XMI File <owned. Member xmi: type='UML: Class' xmi: id='id 345' visibility='public' Excerpt from an XMI File . . .

XMI Transformation File Sample . . .

XMI Transformation File (2) UML model exchange via XMI is difficult in practice Different XMI Transformation File (2) UML model exchange via XMI is difficult in practice Different versions of the XMI Implementations not fully compliant with standards Customizable XMI import to account for this! Default XMI transformation files: For UML 1. 3/1. 4 meta model and XMI 1. x files For UML 2. x meta model and XMI 2. 0 / 2. 1 files Plus specialized files for non-conforming tools

Metric Definition File Contains the definitions of: Design rules Relation matrices Design metrics Complete Metric Definition File Contains the definitions of: Design rules Relation matrices Design metrics Complete documentation with glossary and literature references SDMetrics provides default metric definitions for UML 1. x and UML 2. x meta models

The number of public operations" src="https://present5.com/presentation/5c7bde55a6859a226a21596e5e7e905b/image-30.jpg" alt="Example Metric Definition The number of public operations" /> Example Metric Definition The number of public operations in a class. ((p)) Same as metric: //class/Num. Ops/, but only counts operations with public visibility. ((ul))((li))Also known as: NPM (Number of Public Methods) ref: //LK 94/. ((/ul))

Example Metric Definition (2) Definitions of intermediate “helper” sets and metrics E. g. sets Example Metric Definition (2) Definitions of intermediate “helper” sets and metrics E. g. sets “In. Assoc” and “Out. Assoc” of incoming and outgoing associations for an interface The number of associations the interface participates in.

The interface has outgoing" src="https://present5.com/presentation/5c7bde55a6859a226a21596e5e7e905b/image-32.jpg" alt="Example Rule Definition The interface has outgoing" /> Example Rule Definition The interface has outgoing associations. ((p)) ref: //Oes 04/ suggests to avoid this.

Applications of Design Metrics Building Quality Benchmarks Building Predictive Models Applications of Design Metrics Building Quality Benchmarks Building Predictive Models

Quality Benchmarks (1) Scenario: acquisition of new components Is the design of the components Quality Benchmarks (1) Scenario: acquisition of new components Is the design of the components acceptable? Developed in-house or bought from external source Demand rework if there are expected maintainability/reliability problems Comprehensive inspection/testing often too expensive Need a pointer to potentially critical design areas to inspect or test

Quality Benchmarks (2) Build a database of measurement values Selected measures of size, coupling, Quality Benchmarks (2) Build a database of measurement values Selected measures of size, coupling, complexity Obtained from existing proven, “tried and tested” components Apply measurements to new components Compare obtained measurement distributions

Quality Benchmarks (3) 30 # classes (%) 25 20 15 10 5 0 0 Quality Benchmarks (3) 30 # classes (%) 25 20 15 10 5 0 0 1 2 3 4 5 6 # invoked operations Benchmark Candidate 7 8

Prediction Models Design metrics data difficult to interpret component XYZ has “coupling=5”, “complexity=7” What Prediction Models Design metrics data difficult to interpret component XYZ has “coupling=5”, “complexity=7” What does this mean in terms of … future maintenance work for this component likelihood that the component still contains defects Quantify the relationship between metrics data and system quality for better interpretation

Building A Prediction Model Component Design Statistic Analysis Prediction Model Building A Prediction Model Component Design Statistic Analysis Prediction Model

Using the Prediction Model New Component Design Metrics P(fault)>25% Prediction Model P(fault)<25% Component OK Using the Prediction Model New Component Design Metrics P(fault)>25% Prediction Model P(fault)<25% Component OK

Prediction Model Pros and Cons Pros Captures the combined effect of multiple influencing factors Prediction Model Pros and Cons Pros Captures the combined effect of multiple influencing factors in one cohesive model Translates non-interpretable internal quality data to easily interpreted external quality data Cons Very data intensive Requires statistical expertise