cs428 9 software engineering ii
Download
Skip this Video
Download Presentation
CS428/9: Software Engineering II

Loading in 2 Seconds...

play fullscreen
1 / 33

CS428/9: Software Engineering II - PowerPoint PPT Presentation


  • 98 Views
  • Uploaded on

CS428/9: Software Engineering II. Darko Marinov (slides from Ralph Johnson). Administrative info. ACP third revision due on Thursday, March 15 HW3 posted on Wiki: metrics, due March 27 Will be graded by March 29 and covered in Demo 2 Demo 2: Functionality (code), testing, metrics

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' CS428/9: Software Engineering II' - iola


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
cs428 9 software engineering ii

CS428/9: Software Engineering II

Darko Marinov

(slides from Ralph Johnson)

administrative info
Administrative info
  • ACP third revision due on Thursday, March 15
  • HW3 posted on Wiki: metrics, due March 27
    • Will be graded by March 29 and covered in Demo 2
  • Demo 2: Functionality (code), testing, metrics
    • Will look more than before into your code and tests
    • After Spring Break, around April 3
    • Advisable to meet your TA before Spring Break

428-15

metrics
Metrics
  • Non-technical metrics about process
    • Number of people on project, time taken, money spent
    • Stories implemented
    • Bugs found (by testers/developers, by users)
    • Bugs fixed, features added
  • Technical metrics about product

428-15

technical metrics
Technical metrics
  • Size of code
    • Lines of code (LOC, SLOC, NCNB LOC)
    • Number of files, classes, processes
    • Function points
  • Complexity of code
    • Dependencies / coupling / cohesion
    • OO metrics

428-15

some ways to use metrics
Some ways to use metrics
  • Measure performance of programmers
    • Measure the amount of code produced each month by each programmer
    • Give high producers big raise
  • Prioritize programmers’ effort
    • Measure complexity of modules
    • Pick the most complex and rewrite it
  • Determine whether code is ready to ship

428-15

complexity
Complexity
  • Complex systems are
    • Hard to understand
    • Hard to change
    • Hard to reuse

Cyclomatic complexity (covered last lecture)

Cohesion and coupling (this lecture)

428-15

cyclomatic complexity
Cyclomatic complexity

CC = E – N + 2, where

E is the number of edges and

N is the number of nodes

def addInterest

for

if

acc.balance = ...

done

428-15

technical metrics for oo systems
Technical metrics for OO systems
  • Material from these readings
    • Bob Martin: OO Design Quality Metrics
    • Shyam R. Chidamber and Chris F. Kemerer:A Metrics Suite for Object Oriented Design

428-15

coupling and cohesion
Coupling and cohesion
  • Number and complexity of shared variables
    • Functions in a module should share variables
    • Functions in different modules should not
  • Number and complexity of parameters
  • Number of functions/modules that are called
  • Number of functions/modules that call me

428-15

dhama s coupling metric
Dhama’s coupling metric

Module coupling =

1 / (number of input parameters + number of output parameters + number of global variables used + number of modules called + number of modules calling)

.5 is low coupling, .001 is high coupling.

428-15

martin s coupling metric
Martin’s coupling metric
  • Ca: Afferent coupling: the number of classes outside this module that depend on classes inside this module
  • Ce: Efferent coupling: the number of classes inside this module that depend on classes outside this module
  • Instability = Ce / (Ca + Ce)

428-15

main sequence
Main sequence
  • A: Abstractness (# abstract classes in module / # classes in module)

(0,1)

Abstractness

(1,0)

Instability

428-15

technical metrics1
Technical metrics
  • A Metrics Suite for Object Oriented Design, Shyam R. Chidamber and Chris F. Kemerer IEEE Transactions on Software Engineering, June 1994, pp 476-493
  • Chapter 4 of Hamlet and Maybee, especially 4.3

428-15

list of metrics
List of metrics
  • Weighted Methods per Class
  • Depth of Inheritance Tree
  • Number Of Children
  • Coupling Between Object classes
  • Response for a Class
  • Lack of Cohesion in Methods

428-15

weighted methods per class
Weighted Methods per Class

WMC: for each class, take the sum of the complexities of the methods in the class

Possible method complexities

  • 1 (number of methods)
  • Lines of code
  • Number of method calls
  • Cyclomatic complexity

428-15

weighted methods per class1
Weighted Methods per Class
  • The number of methods and the complexity of methods predicts the time and effort required to develop and maintain a class
  • The larger the number of methods in a class, the greater the potential impact on children
  • Classes with large numbers of methods are more likely to be application specific and less reusable

428-15

depth of inheritance tree
Depth of Inheritance Tree
  • DIT: Maximum length from a class to the root of the tree
  • The deeper a class is in the hierarchy, the more methods it inherits and so it is harder to predict its behavior
  • The deeper a class is in the hierarchy, the more methods it reuses
  • Deeper trees are more complex

428-15

number of children
Number Of Children
  • NOC: Number of immediate subclasses
  • More children is more reuse
  • A class might have a lot of children because of misuse of subclassing
  • A class with a large number of children is probably very important and needs a lot of testing

428-15

number of children1
Number of Children
  • Almost all classes have 0 children
  • Only a handful of classes will have more than five children

428-15

coupling between object classes
Coupling Between Object classes
  • CBO: Number of other classes to which a class is coupled
  • Class A is coupled to class B if there is a method in A that invokes a method of B
  • Want to be coupled only with abstract classes high in the inheritance hierarchy

428-15

coupling between object classes1
Coupling Between Object classes
  • Coupling makes designs hard to change
  • Coupling makes classes hard to reuse
  • Coupling is a measure of how hard a class is to test

428-15

coupling between object classes2
Coupling Between Object classes
  • C++ project: median 0, max 84
  • Smalltalk project: median 9, max 234

428-15

response for a class
Response For a Class
  • RFC: Number of methods in a class or called by a class
  • The response set of a class is a set of methods that can potentially be executed in response to a message received by an object of that class

428-15

response for a class1
Response For a Class
  • If a large number of methods can be invoked in response to a message, testing becomes more complicated
  • The more methods that can be invoked from a class, the greater the complexity of the class

428-15

response for a class2
Response For a Class
  • C++: median 6, max 120
  • Smalltalk: median 29, max 422

428-15

lack of cohesion in methods
Lack of COhesion in Methods
  • LCOM: Number of pairs of methods that don’t share instance variables - number of pairs of methods that share instance variables
  • Cohesiveness of methods is a sign of encapsulation.
  • Lack of cohesion implies classes should be split

428-15

lack of cohesion in methods1
Lack of COhesion in Methods
  • C++: median 0, max 200
  • Smalltalk: median 2, max 17
  • Smalltalk system had only a few zero

428-15

what is best
What is best?
  • WMC or list of long methods?
  • DIT or list of classes with depth over 6?
  • NOC or list of classes with more than 6 children?
  • CBO or list of classes with high coupling?

428-15

questions
Questions?
  • Who looks at these figures?
  • What is done with the results?
  • How do you get the figures?

428-15

the goal of measurement
The goal of measurement
  • Software measurement is a means to an end, not an end in itself
  • What is causing poor quality?
  • Where are we spending all our time on software development?
  • How accurate are our estimates?
  • What is the most cost-effective way to improve our quality?

428-15

next time
Next time
  • Software Measurement Guidebook
  • http://swg.jpl.nasa.gov/resources/NASA-GB-001-94.pdf
  • Pages 1-20 and 30-49

428-15

ad