Supplementary Slides for Software Engineering: A Practitioner's Approach, 5/e

Download Report

Transcript Supplementary Slides for Software Engineering: A Practitioner's Approach, 5/e

Supplementary Slides for
Software Engineering:
A Practitioner's Approach, 5/e
copyright © 1996, 2001
R.S. Pressman & Associates, Inc.
For University Use Only
May be reproduced ONLY for student use at the university level
when used in conjunction with Software Engineering: A Practitioner's Approach.
Any other reproduction or use is expressly prohibited.
This presentation, slides, or hardcopy may NOT be used for
short courses, industry seminars, or consulting purposes.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
1
Slide 26
Chapter 24
Technical Metrics for
Object-Oriented Systems
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
2
Distinguishing Characteristics
Berard [BER95] argues that the following characteristics require
that special OO metrics be developed:
 Localization—the way in which information is concentrated
in a program
 Encapsulation—the packaging of data and processing
 Information hiding—the way in which information about
operational details is hidden by a secure interface
 Inheritance—the manner in which the responsibilities of one
class are propagated to another
 Abstraction—the mechanism that allows a design to focus on
essential details
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
3
Class-Oriented Metrics
Proposed by Chidamber and Kemerer (CK Metrics):
 weighted methods per class (WMC)
 WMC =  ci for I = 1 to n
 Where ci is complexity of method i
 Inheritance may complicate the counting
 depth of the inheritance tree (DIT)
 number of children (NOC)
 coupling between object classes (CBO)
 response for a class (RFC)
 Set of methods that are potentially executed in response to a
message
 lack of cohesion in methods (LCOM)
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
4
Class-Oriented Metrics
Proposed by Lorenz and Kidd [LOR94]:
 class size (CS)
 Total number of operations
 The number of attributes
  too much responsibility would reduce reusability
 number of operations overridden by a subclass (NOO)
 number of operations added by a subclass (NOA)
 specialization index (SI)
 Specialization achieved by adding or deleting operations by overriding
 SI = (NOO * level)/M
level is the level in the class hierarchy, M is number of methods
 The higher the SI, the more likely do not conform to the superclass
abstraction
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
5
Class-Oriented Metrics
The MOOD Metrics Suite
Method inheritance factor (MIF)
 The degree of the use of inheritance
Coupling factor (CF)
 Connections between elements of the OO design
Polymorphism factor (PF)
 Indirect measure of the amount of dynamic binding in a
system
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
6
Operation-Oriented Metrics
Proposed by Lorenz and Kidd [LOR94]:
 average operation size (OSavg)
 LOC or
 Number of messages sent by operation
 operation complexity (OC)
 Use complexity metrics
 average number of parameters per operation (NPavg)
 Affect the complexity of collaboration
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
7
Testability Metrics
Proposed by Binder [BIN94]:
encapsulation related
 lack of cohesion in methods (LCOM)
 percent public and protected (PAP)
 public access to data members (PAD)
inheritance related
 number of root classes (NOR)
 fan in (FIN)
 Indication of multiple inheritance
 number of children (NOC) and depth of
inheritance tree (DIT)
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
8
OO Project Metrics
Proposed by Lorenz and Kidd [LOR94]:
 number of scenario scripts (NSS)
 Number of scenario script/use case is proportional to the
number of classes
 number of key classes (NKC)
 Low probability for reuse  substantial work
 number of subsystems (NSUB)
 Provides insight into resource allocation, scheduling &
integration effort
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 5/e and are
provided with permission by R.S. Pressman & Associates, Inc., copyright © 1996, 2001
9