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

CSC310 Lecture 12

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest. →

CSC310 Lecture 12

Metrics

Avatar for Javier Gonzalez-Sanchez

Javier Gonzalez-Sanchez PRO

October 15, 2026

Transcript

  1. Abstractness • It is the degree to which implement tion

    • It is cl ss or p ck ge emph sizes bstr ction over concrete v lue 0 to 1: • For p ck ges, It is the r tio of bstr ct cl sses or interf ces to the tot l number of cl sses within p ck ge. • For cl sses, It is 0 for concrete cl ss nd 1 for n interf ce or bstr ct cl sses a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a 4
  2. Instability • Indic tes whether: ( ) the item is

    m inly used by others (st ble – h rd to ch nge); or (b) it m inly depends on other items (in-st ble – ch nge ble). • It is v lue between 0 nd 1: • 0 only incoming dependencies to • 1 (only outgoing dependencies). a a a a a a a a a a a a a 5
  3. Distance • Dist nce: how f r p ck ge

    is w y from the M in Sequence • D=A+I–1 • V lues -1 to 1 • Absolute Dist nce |D| a a a a a a a a a a 6
  4. Distance 1 Abstract e th Abstractness Useless i ma n

    c en qu se e Painful Concrete 0 7 0 Stable Hard to Change Only incoming dependencies Instability 1 Unstable Changeable Only outgoing dependencies
  5. Function Metrics • Cyclomatic Complexity. It is a quantitative measure

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

    CC = ConditionalNodes + 1 14
  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 15
  8. Cyclomatic Complexity Complexity Number 16 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
  9. Lab

  10. CSC 3100 Software Engineering Javier Gonzalez-Sanchez, Ph.D. [email protected] Fall 2026

    Copyright. These slides may be used only as study material for CSC 5100 within the California State University system. They may not be distributed or used for any other purpose.