Upgrade to Pro — share decks privately, control downloads, hide ads and more …

CSC305 Lecture 12

CSC305 Lecture 12

Individual Software Design and Development
Quality
(202510)

Avatar for Javier Gonzalez-Sanchez

Javier Gonzalez-Sanchez PRO

October 16, 2025
Tweet

More Decks by Javier Gonzalez-Sanchez

Other Decks in Programming

Transcript

  1. Dr. Javier Gonzalez-Sanchez [email protected] www.javiergs.info o ffi ce: 14 -227

    CSC 305 Individual Software Design and Development Lecture 12. Quality
  2. Abstractness • Indic a tes whether: ( a ) the

    item is m a inly a bstr a ct (interf a ces, a bstr a ct cl a sses – extensible but not directly us a ble); or (b) it is m a inly concrete (implement a tions – directly us a ble but less extensible). • It is a v a lue between 0 a nd 1: 0 ( a concrete cl a ss or a p a ck a ge with only concrete cl a sses) 1 ( a n a bstr a ct cl a ss/interf a ce or a p a ck a ge with only a bstr a ct cl a sses/interf a ces) 3
  3. Instability • Indic a tes whether: ( a ) the

    item is m a inly used by others (st a ble – h a rd to ch a nge); or (b) it m a inly depends on other items (in-st a ble – ch a nge a ble). • It is a v a lue between 0 a nd 1: • 0 only incoming dependencies to • 1 (only outgoing dependencies). 4
  4. Distance 5 Abstract Concrete Stable Hard to Change Only incoming

    dependencies Unstable Changeable Only outgoing dependencies the main sequence Painful Useless 0 1 1 0 Instability Abstractness
  5. Function Metrics • Cyclomatic Complexity. It is a quantitative measure

    of the number of linearly independent paths. • P a ths occur when "while,” "for,” "if,” "c a se," a nd "goto" keywords a ppe a r within the function. • If the source code cont a ined no control f low st a tements (condition a ls or decision points), the complexity would be 1 • If the code h a d one single-condition IF st a tement, there would be two p a ths through the code: one where the IF st a tement ev a lu a tes to TRUE a nd a nother one where it considers to be FALSE. • Two nested single-condition IFs, or one block with two conditions, would produce a complexity of 3. 8
  6. Cyclomatic Complexity 9 CC = Edge - Node + 2

    Or CC = ConditionalNodes + 1
  7. Cyclomatic Complexity i = 0; n=4; while (i<n-1) { j

    = i + 1; while (j<n) { if (A[i]<A[j]) swap(A[i], A[j]); } i=i+1; } // CC = 9 - 7 + 2 = 4 // CC = 3 + 1 = 4 (Condition nodes are 1,2 and 3 nodes) // A set of possible execution path of a program // 1, 7 // 1, 2, 6, 1, 7 // 1, 2, 3, 4, 5, 2, 6, 1, 7 // 1, 2, 3, 5, 2, 6, 1, 7 10
  8. Complexity Number Meaning 1-10 Structured and well written code High

    Testability Cost and Effort is less 10-20 Complex Code Medium Testability Cost and effort is Medium 20-40 Very complex Code Low Testability Cost and Effort are high >40 Not at all testable Very high Cost and Effort Cyclomatic Complexity 11
  9. Lab

  10. CSC 305 Individual Software Design and Development Javier Gonzalez-Sanchez, Ph.D.

    [email protected] Fall 2025 Copyright. These slides can only be used as study material for the class CSC305 at Cal Poly. They cannot be distributed or used for another purpose.