Slide 1

Slide 1 text

Dr. Javier Gonzalez-Sanchez [email protected] www.javiergs.info o ffi ce: 14 -227 CSC 305 Individual Software Design and Development Lecture 12. Quality

Slide 2

Slide 2 text

Quality Metrics Structural

Slide 3

Slide 3 text

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

Slide 4

Slide 4 text

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

Slide 5

Slide 5 text

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

Slide 6

Slide 6 text

Example 6 Write the Source Code

Slide 7

Slide 7 text

Software Metrics Complexity

Slide 8

Slide 8 text

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

Slide 9

Slide 9 text

Cyclomatic Complexity 9 CC = Edge - Node + 2 Or CC = ConditionalNodes + 1

Slide 10

Slide 10 text

Cyclomatic Complexity i = 0; n=4; while (i

Slide 11

Slide 11 text

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

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

No content

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

Questions 19

Slide 20

Slide 20 text

Lab

Slide 21

Slide 21 text

Calculate D, I, A 21

Slide 22

Slide 22 text

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.