Design Quality Metrics - PowerPoint PPT Presentation

1 / 13
About This Presentation
Title:

Design Quality Metrics

Description:

Po Box 44330. Lafayette, LA 70504, USA. arun_at_cacs.usl.edu. Jump to first page ... How do you compare design alternatives? How do you critique a design? What is Design? ... – PowerPoint PPT presentation

Number of Views:17
Avg rating:3.0/5.0
Slides: 14
Provided by: arunla
Category:
Tags: design | metrics | po | quality | you

less

Transcript and Presenter's Notes

Title: Design Quality Metrics


1
Design Quality Metrics
  • Arun Lakhotia
  • University of Southwestern Louisiana
  • Po Box 44330
  • Lafayette, LA 70504, USA
  • arun_at_cacs.usl.edu

2
Reference
  • Steve McConnell, Code Complete, Microsoft Press,
    1993.
  • See Chapter 5
  • Keywords
  • Cohesion
  • Coupling

3
Aim
  • How do you compare design alternatives?
  • How do you critique a design?
  • What is Design?
  • Decomposition into functions
  • Decomposition into modules
  • Decomposition into classes

4
Function Decomposition
5
Reasons for creating routines
  • Reducing complexity
  • Avoiding duplicate code
  • Limiting effects of change
  • Hiding sequences
  • Improving performance
  • Making central points of control
  • Hiding data structures
  • Hiding global data
  • Hiding pointer operations
  • Promoting code reuse
  • Planning for a family of programs
  • Making code reusable
  • Improving portability
  • Isolating complex operations
  • Isolating use of nonstandard language
  • Simplifying complicated boolean tests
  • Modularization

6
Quality of function decomposition
  • May be defined in terms of
  • Quality of individual functions
  • Measured as cohesion
  • Quality of interaction between functions
  • Measured as coupling
  • Desired decomposition
  • High cohesion
  • Low coupling

7
Cohesion
  • How strongly internal components are related?
  • Poor/low cohesion
  • A function does several unrelated activities
  • Removing one activity does not affect another
    activity
  • Good/High cohesion
  • A function performs activities that are related
  • Removing/changing one affects the other

8
Acceptable cohesion
  • Functional cohesion
  • function performs only one activity
  • Sequential cohesion
  • Contains activities that are order dependent
    based on data flow
  • Communicational cohesion
  • Activities use the same data but are not
    otherwise related
  • Temporal cohesion
  • Activities to be performed at the same time
    (initialize, cleanup)

9
Unacceptable cohesion
  • Procedural cohesion
  • Contains activities ordered on user interaction
    or directly dependent on requirements
  • Logical cohesion
  • Activities are mutually exclusive, selected on a
    flag
  • Coincidental cohesion
  • No apparent cohesion

10
Interconnections between functions
  • Call
  • Called
  • Parameters passed
  • Global variables

11
Coupling
  • How strongly are multiple functions related?
  • Strong relation, implies high coupling, implies
    poor code
  • Weak relation, implies low coupling, implies good
    code

12
Acceptable coupling
  • Simple data coupling
  • data passed through parameters
  • data passed is not structured
  • Data structure coupling
  • Data passed through parameters
  • Data passed IS structured

13
Unacceptable coupling
  • Control coupling
  • Data passed is used to make control decision
  • Global data coupling
  • Communicate through global variables
  • Pathological coupling
  • One routine modifies the code or data of another
    routine
Write a Comment
User Comments (0)
About PowerShow.com