Design Metrics for Object-Oriented Software Systems

Similar documents
CHAPTER 4 HEURISTICS BASED ON OBJECT ORIENTED METRICS

Quantify the project. Better Estimates. Resolve Software crises

Research Article ISSN:

Object-oriented metrics 1

Object Oriented Metrics. Impact on Software Quality

Part 7 - Object Oriented Concepts Classes, Objects, Properties and Methods

Object Oriented Measurement

Reusability Metrics for Object-Oriented System: An Alternative Approach

Programming Languages 2nd edition Tucker and Noonan"

A Hierarchical Model for Object- Oriented Design Quality Assessment

Object-Oriented Design

HOW AND WHEN TO FLATTEN JAVA CLASSES?

Usability Evaluation of Software Testing Based on Analytic Hierarchy Process Dandan HE1, a, Can WANG2

Component-Based Software Engineering TIP

Object-Oriented Design

Chapter 8: Class and Method Design

Object Oriented Programming

CHAPTER 5 GENERAL OOP CONCEPTS

Introduction to Software Engineering p. 1 The Scope of Software Engineering p. 3 Historical Aspects p. 4 Economic Aspects p. 7 Maintenance Aspects p.

AOSA - Betriebssystemkomponenten und der Aspektmoderatoransatz

Software Design Patterns. Background 1. Background 2. Jonathan I. Maletic, Ph.D.

Concepts of Programming Languages

The Software Design Process. CSCE 315 Programming Studio, Fall 2017 Tanzir Ahmed

Chapter 5 Object-Oriented Programming

Why testing and analysis. Software Testing. A framework for software testing. Outline. Software Qualities. Dependability Properties

CS SOFTWARE ENGINEERING QUESTION BANK SIXTEEN MARKS

An Introduction to Object-Oriented Programming

CHAPTER 2 LITERATURE REVIEW

Study of Component Based Software Engineering

Enhancing Mood Metrics Using Encapsulation

Coding and Unit Testing! The Coding Phase! Coding vs. Code! Coding! Overall Coding Language Trends!

SHOTGUN SURGERY DESIGN FLAW DETECTION. A CASE-STUDY

XVIII. Software Testing. Laurea Triennale in Informatica Corso di Ingegneria del Software I A.A. 2006/2007 Andrea Polini

Presenter: Dong hyun Park

Software Engineering

PC204. Lecture 5 Programming Methodologies. Copyright 2000 by Conrad Huang and the Regents of the University of California. All rights reserved.

Chapter 11. Categories of languages that support OOP: 1. OOP support is added to an existing language

QUIZ #5 - Solutions (5pts each)

Classes and Objects. Object Orientated Analysis and Design. Benjamin Kenwright

Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Taxonomy Dimensions of Complexity Metrics

Software Testing Strategies. Slides copyright 1996, 2001, 2005, 2009, 2014 by Roger S. Pressman. For non-profit educational use only

Describing the architecture: Creating and Using Architectural Description Languages (ADLs): What are the attributes and R-forms?

Maintenance Phase. Maintenance Type

Welcome to Design Patterns! For syllabus, course specifics, assignments, etc., please see Canvas

Data Structures and Algorithms Design Goals Implementation Goals Design Principles Design Techniques. Version 03.s 2-1

Software Design. Levels in Design Process. Design Methodologies. Levels..

Future Directions in Simulation Modeling. C. Dennis Pegden

Object-Oriented Concepts and Design Principles

CHAPTER 3 ROLE OF OBJECT-ORIENTED METRICS IN SOFTWARE MEASUREMENT

Verification and Validation. Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 22 Slide 1

Testing! Prof. Leon Osterweil! CS 520/620! Spring 2013!

Object-Oriented Design Quality Models A Survey and Comparison

Object Orientated Analysis and Design. Benjamin Kenwright

Component-Based Software Engineering TIP

Patterns for polymorphic operations

REVIEW OF THE BASIC CHARACTERISTICS OF OBJECT ORIENTATION

Software Engineering

THE ADHERENCE OF OPEN SOURCE JAVA PROGRAMMERS TO STANDARD CODING PRACTICES

What are the characteristics of Object Oriented programming language?

OBJECT ORIENTED SYSTEM DEVELOPMENT Software Development Dynamic System Development Information system solution Steps in System Development Analysis

Towards Cohesion-based Metrics as Early Quality Indicators of Faulty Classes and Components

NOTES ON OBJECT-ORIENTED MODELING AND DESIGN

A Study on Website Quality Models

In this Lecture you will Learn: Design Patterns. Patterns vs. Frameworks. Patterns vs. Frameworks

Impact of Dependency Graph in Software Testing

Goals of design. satisfies problem requirements, usable error free, resistant to incorrect input. readable, not purposefully cryptic.

Inheritance Metrics: What do they Measure?

Gradational conception in Cleanroom Software Development

SOFTWARE ASSESSMENT USING OBJECT METRICS

Software Quality Estimation through Object Oriented Design Metrics

Part 5. Verification and Validation

A STUDY OF OBJECT ORIENTED ANALYSIS AND DESIGN

Software Design Fundamentals. CSCE Lecture 11-09/27/2016

Object Oriented Design Metrics for Predicting Fault Proneness using Naïve Bayes and Random Forest

CS 292 Software Development

Boca Raton Community High School AP Computer Science A - Syllabus 2009/10

What is Software Architecture

Low Level Design Activities. Implementation (Low Level Design) What is a Good Low Level Module? Black Box Aspects. Black box aspects White box aspects

Object-oriented perspective

SOFTWARE LIFE-CYCLE MODELS 2.1

Software Architecture and Design I

A201 Object Oriented Programming with Visual Basic.Net

Software Reuse and Component-Based Software Engineering

is easing the creation of new ontologies by promoting the reuse of existing ones and automating, as much as possible, the entire ontology

Online Assessment of Programming Exercises

FOR0383 Software Quality Assurance

COP 3330 Final Exam Review

From Module To Objects

Testing Component-Based Software

A study of the impact of C++ on software maintenance

Smallworld Core Spatial Technology 4 Smallworld MAGIK : The object oriented language for an object oriented world

Chapter 8 Software Testing. Chapter 8 Software testing

Static Metrics. Feature Brief

Introduction to Software Testing

Programming II. Modularity 2017/18

Verification and Validation. Assuring that a software system meets a user s needs. Verification vs Validation. The V & V Process

Setting the stage... Key Design Issues. Main purpose - Manage software system complexity by improving software quality factors

Advanced Database Applications. Object Oriented Database Management Chapter 13 10/29/2016. Object DBMSs

International Journal of Software and Web Sciences (IJSWS) EVALUATING TESTABILITY OF OBJECT ORIENTED SYSTEM

Transcription:

ECOOP 95 Quantitative Methods Workshop Aarhus, August 995 Design Metrics for Object-Oriented Software Systems PORTUGAL

Design Metrics for Object-Oriented Software Systems Page 2 PRESENTATION OUTLINE This presentation proposes: The experimental validation of a set of metrics suitable for evaluating the use of the mechanisms that support the main concepts of the Object-Oriented paradigm and the consequent emphasis on reuse, that are believed to be responsible for the increase in software quality and development productivity.

Design Metrics for Object-Oriented Software Systems Page 3 QUALITY: TWO SCHOOLS OF THOUGHT Software quality can be characterized by the presence of several external attributes. However no consensus on how to evaluate those external attributes some attributes can only be assessed when the system is available (too late...) THE "OUTSIDE-IN" APPROACH FOR QUALITY: A defined and controlled process is a required condition for the production of quality software products and with fewer costs THE "INSIDE-OUT" APPROACH FOR QUALITY: The quality of internal structure is a required condition for ensuring that external quality and increased productivity are achieved.

Design Metrics for Object-Oriented Software Systems Page 4 "INSIDE-OUT" QUALITY IN OBJECT-ORIENTATION Internal quality in OO is due to the use of: encapsulation information hiding inheritance polymorphism message passing reuse (class, pattern or framework level) the use of mechanisms that support those concepts can be varied, depending on the designer ability - several alternatives for the same system are possible for the same specification we can expect rather different quality products to emerge, as well as different productivity gains, depending on the corresponding design

Design Metrics for Object-Oriented Software Systems Page 5 GOAL, STRATEGY AND TACTICS Goal: Improve the OO design process to achieve better maintainability and reusability, by setting design recommendations (heuristics). Those may be included in OO CASE tools. Strategy: Identify structural quality in designs by means of quantitative evaluation of the use of the OO paradigm mechanisms that are supposed to be responsible for internal quality Tactics: Establish comparisons throughout the academic and practitioners community

Design Metrics for Object-Oriented Software Systems Page 6 CRITERIA FOR DESIRED METRICS Criterion : metrics determination should be formally defined different people at different times or places get the same values for the same systems avoids subjective ratings (e.g. Very Low, Low, Average, High, Very High) Criterion 2: non-size metrics should be system size independent allows comparisons across different projects (cumulative knowledge) Criterion 3: metrics should be dimensionless or expressed in some unit system avoids subjective or "artificial" units that inevitably yield to misunderstandings. (e.g. LOC, Function Points)

Design Metrics for Object-Oriented Software Systems Page 7 Criterion 4: metrics should be obtainable early in the life-cycle allows to identify possible flaws, before too much effort is built on top of them Criterion 5: metrics should be orthogonal thus representing different aspects of the system under measurement Criterion 6: metrics should be easily computable eases the repetitive, tedious and expensive collection process requires that criterion is met and that designs are also formally defined Criterion 7: metrics should be language independent allows a common base of understanding for the metrics analysis process

Design Metrics for Object-Oriented Software Systems Page 8 THE MOOD METRICS SET (V.2) (Metrics for Object Oriented Design) Several authors have suggested sets of metrics for the OO paradigm, but none known fulfills all the above criteria. The MOOD metrics are: Attribute Hiding Factor Method Hiding Factor Method Inheritance Factor Attribute Inheritance Factor Coupling Factor Polymorphism Factor Clustering Factor Reuse Factor These metrics can be viewed as probabilities - quantifying the use of different abstractions - ranging from 0 (total absence of use) to (maximum possible use) They allow the application of statistical theory to software metrics

Design Metrics for Object-Oriented Software Systems Page 9 VALIDATION EXPERIMENT THE SAMPLE (all in C++ source code): Microsoft Foundation Classes (MFC) - Microsoft Corporation GNU glib++ (GNU) - Free Software Foundation / Cygnus Support ET++ library (ET++) - UBILAB / Union des Banques Suisses (Switzerland) NewMat library (NMAT) - Robert B. Davies (Victoria University - New Zealand) MotifApp library (MOTIF) - Douglas A. Young [Young92] Sun C++ Compiler Class library (SunC++) - Sun Corporation Centerline C++ Compiler Class Library (Centerline) - Centerline Corporation Not Invented Here Class Library (NIHCL) - Free Software Foundation MFC GNU ET++ NewMat Motif SunC++ Centerline NIHCL TOTAL Classes 35 84 262 90 35 54 36 64 760 Methods 2970 478 482 88 99 465 428 2094 3327 Attributes 63 5 980 9 76 9 02 8 234 LOC 74895 3237 55022 2795 4884 36487 4636 535 236405 Table - Some indicators of sample size

Design Metrics for Object-Oriented Software Systems Page 0 Information Hiding Attributes (or variables, fields, data members,...) may be visible or hidden A ( C ) = A ( C ) + A ( C ) d i v i h i Attribute Hiding Factor AHF Ah ( Ci ) = = A ( C ) d i A ( C ) A v d i ( C ) i

Design Metrics for Object-Oriented Software Systems Page SAMPLE VALUES FOR AHF 00% 90% 80% 70% 60% 50% 40% 30% 20% Attribute Hiding Factor (AHF) GNU MFC ET++ NewMat Motif SunC++ Centerline NIHCL AHF MFC 67.7% GNU 85.0% ET++ 69.0% NewMat 83.2% Motif 97.% SunC++ 80.2% Centerline 8.9% NIHCL 90.4% 0% 0%

Design Metrics for Object-Oriented Software Systems Page 2 HEURISTIC FOR AHF AHF and MHF are a measure of the use of the information hiding concept that is supported by the encapsulation mechanism. Information hiding should be used to: cope with complexity by looking at complex components such as black boxes reduce "side-effects" provoked by implementation refinement support a top-down approach test and integrate systems incrementally. 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0. 0 AHF For attributes (AHF) we want this mechanism to be used as much as possible. Ideally all attributes would be hidden (being only accessed by the corresponding class methods) Very low values for AHF should trigger the designers attention.

Design Metrics for Object-Oriented Software Systems Page 3 Information Hiding Methods (or operations, function members, tasks, routines,...) may be visible or hidden M ( C ) = M ( C ) + M ( C ) d i v i h i Method Hiding Factor MHF M h( Ci) = = M ( C ) d i M ( C ) M v d i ( C ) i

Design Metrics for Object-Oriented Software Systems Page 4 SAMPLE VALUES FOR MHF 00% Method Hiding Factor (MHF) 90% 80% 70% 60% 50% 40% 30% 20% 0% MFC GNU ET++ NewMat Motif SunC++ Centerline NIHCL MHF MFC 24.0% GNU 2.9% ET++ 9.5% NewMat 0.3% Motif 36.9% SunC++ 6.9% Centerline 4.3% NIHCL 2.7% 0%

Design Metrics for Object-Oriented Software Systems Page 5 HEURISTIC FOR MHF The number of visible methods is a measure of the class functionality. Increasing the overall functionality will reduce MHF. For implementing that functionality we must adopt a top-down approach, where the abstract interface (visible methods) should only be the tip of the iceberg. This suggests a MHF increase. MHF 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0. 0 Very low MHF indicate an insufficiently abstracted implementation. Very high MHF indicate very little functionality

Design Metrics for Object-Oriented Software Systems Page 6 Inheritance Methods available in a class instance (response for a class) can be the defined ones or inherited ones (not overridden): M ( C ) = M ( C ) + M ( C ) a i d i i i Methods defined in a class can be new (locally defined) or a redefined version (overriding) of inherited ones: M ( C ) = M ( C ) + M ( C ) d i n i o i Method Inheritance Factor MIF Mi( Ci) = = M ( C ) a i M M d a ( C ) i ( C ) i

Design Metrics for Object-Oriented Software Systems Page 7 Inheritance Attributes available in a class can be the defined ones or inherited ones (not overridden): A ( C ) = A ( C ) + A ( C ) a i d i i i Attributes defined in a class can be new (locally defined) or a redefined version (overriding) of inherited ones: A ( C ) = A ( C ) + A ( C ) d i n i o i Attribute Inheritance Factor AIF Ai( Ci) = = A ( C ) a i A ( C ) d i A ( C ) a i

Design Metrics for Object-Oriented Software Systems Page 8 SAMPLE VALUES FOR MIF Method Inheritance Factor (MIF) 00% 90% MFC ET++ 80% 70% 60% 50% 40% 30% 20% GNU NewMat Motif SunC++ Centerline NIHCL MIF MFC 84.4% GNU 63.% ET++ 83.9% NewMat 72.5% Motif 64.3% SunC++ 73.3% Centerline 75.8% NIHCL 60.9% 0% 0%

Design Metrics for Object-Oriented Software Systems Page 9 SAMPLE VALUES FOR AIF 00% Attribute Inheritance Factor (AIF) 90% 80% 70% 60% 50% 40% 30% 20% MFC GNU ET++ NewMat Motif SunC++ Centerline NIHCL AIF MFC 6.3% GNU 62.6% ET++ 5.8% NewMat 58.% Motif 50.3% SunC++ 72.2% Centerline 75.7% NIHCL 37.4% 0% 0%

Design Metrics for Object-Oriented Software Systems Page 20 HEURISTICS FOR MIF AND AIF MIF and AIF are measures of inheritance. This allows: expressing similarity among classes the portrayal of generalization and specialization relations simplification of the definition of inheriting classes, by means of reuse However, the composition of several inheritance relations builds a tree, whose depth and width make understandability and testability quickly fade away. MIF AIF 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0. 0 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0. 0

Design Metrics for Object-Oriented Software Systems Page 2 Polymorphism Polymorphism Factor PF = M ( C ) o M ( C ) DC( C ) n i i i Numerator: possible different polymorphic situations (system under consideration) Denominator: maximum number of possible different polymorphic situations (extreme situation where all methods were overridden in all classes, except the base ones)

Design Metrics for Object-Oriented Software Systems Page 22 SAMPLE VALUES FOR PF: 00% Polymorphism Factor (PF) 90% 80% 70% 60% 50% 40% 30% 20% 0% 0% MFC GNU ET++ NewMat Motif SunC++ Centerline NIHCL PF MFC 2.0% GNU 2.6% ET++ 4.5% NewMat 2.7% Motif 9.8% SunC++ 2.% Centerline.7% NIHCL 5.%

Design Metrics for Object-Oriented Software Systems Page 23 HEURISTIC FOR PF: By allowing to bind a common message call to one of several class instances, polymorphism allows: to build flexible systems refinement of the taxonomy without side-effects 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0. 0 COF However if we need to debug such a taxonomy, by tracing the control flow, this same polymorphism will make the job harder. This is particularly true if we compare this situation with the procedural counterpart where, for a similar functionality, we usually have a series of decision statements for triggering the required operation.

Design Metrics for Object-Oriented Software Systems Page 24 Coupling A client class is the one that contains at least one reference to a feature (or the whole) of another class (the supplier). References can be of several kinds: messages (or event, stimulus,...) to another class instance (dynamic coupling) references due to semantic associations (static coupling) / object containment Coupling Factor COF = j= is_ client( C, C ) 2 2 DC( C ) i j i C C C C iff is_ client( C, C ) = ( C C ) c s 0 otherwise c s c s c s

Design Metrics for Object-Oriented Software Systems Page 25 SAMPLE VALUES FOR COF 00% Coupling Factor (COF) 90% 80% 70% 60% 50% 40% 30% 20% 0% MFC GNU ET++ NewMat Motif SunC++ Centerline NIHCL COF MFC 8.8% GNU 2.6% ET++ 4.4% NewMat 24.3% Motif 6.3% SunC++ 3.% Centerline 4.3% NIHCL 3.8% 0%

Design Metrics for Object-Oriented Software Systems Page 26 HEURISTIC FOR COF It has been noted [Meyer88] that it is desirable that classes communicate with as few others as possible and even then, that they exchange as little information as possible. Coupling relations increase complexity, reduce encapsulation and potential reuse, and limit understandability and maintainability. 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0. 0 COF Thus, it seems that we should avoid it as much as possible. Very high values of COF should be avoided by designers. However, for a given application, classes must cooperate somehow to deliver some kind of functionality. Therefore, COF is expected to be lower bounded.

Design Metrics for Object-Oriented Software Systems Page 27 HEURISTICS IN NUMBERS... Minimum Mean Maximum Shape MHF 2.7% 7.3% 2.8% BP AHF 75.2% 8.9% HP MIF 66.4% 72.4% 78.5% BP AIF 52.7% 59.5% 66.3% BP COF 4.0% 7.6%.2% BP PF 2.7% 6.% 9.6% BP Table 2-95% Confidence interval for the sample A few values below the 0% percentile and above the 90% percentile were set to the corresponding percentile limit values (outlier removal)

Design Metrics for Object-Oriented Software Systems Page 28 SIZE INDEPENDENCE Classes Methods Attrib. LOC MHF -0.4-0.23-0.2-0.02 AHF -0.75-0.7-0.80-0.84 MIF 0.67 0.57 0.75 0.68 AIF -0.3-0.42-0.28 0.04 COF -0.08-0.0-0.5-0.22 PF -0.8-0.3-0.28-0.52 Table 3 - Correlation of MOOD metrics with some size metrics

Design Metrics for Object-Oriented Software Systems Page 29 MOOD METRICS ORTHOGONALITY MHF AHF MIF AIF COF PF MHF 0.40-0.26-0.30 0.04 0.7 AHF -0.9-0.28 0.7 0.58 MIF 0.28-0.4-0.50 AIF -0.47-0.73 COF 0.82 PF Table 4 - Correlation among MOOD metrics

Design Metrics for Object-Oriented Software Systems Page 30 EVOLUTION OF OUR RESEARCH i) MOOD metrics set proposal [Abreu94] ii) practical validation of the underlying rationale of the proposed set iii) construction and public distribution of a tool for automatic collection of MOOD metrics iv) support for industrial and academic wide experimentation and statistical validation v) theoretical validation of the MOOD metrics (using Measurement Theory) vi) MOOD set refinement based on iii) and iv) results (MOOD V2 proposal) vii) embedding of MOOD V2 and corresponding design heuristics on a OO CASE tool viii) assessment of correlation between MOOD and maintainability sub-characteristics