Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

Successfully reported this slideshow.

Like this presentation? Why not share!

- The AI Rush by Jean-Baptiste Dumont 2878970 views
- AI and Machine Learning Demystified... by Carol Smith 4257711 views
- 10 facts about jobs in the future by Pew Research Cent... 1273802 views
- Harry Surden - Artificial Intellige... by Harry Surden 988055 views
- Inside Google's Numbers in 2017 by Rand Fishkin 1560389 views
- Pinot: Realtime Distributed OLAP da... by Kishore Gopalakri... 788458 views

826 views

Published on

Cyclomatic complexity - The complexity of algorithms

Published in:
Software

No Downloads

Total views

826

On SlideShare

0

From Embeds

0

Number of Embeds

0

Shares

0

Downloads

28

Comments

0

Likes

1

No embeds

No notes for slide

- 1. Cyclomatic complexity The complexity of algorithms
- 2. Code Coverage Where Does It Fit? - Tom McCabe (tmccabe@mccabe.com) 2 Test Focus: Requirements Validation Audience: User Code Coverage: Supplemental Positive Test: Testing things in your specs that you already know about Test Focus: Implementation Validation Audience: Code Code Coverage: Primary Negative Test: Testing things that may not be in your specs but in the implementation White Box vs. Black Box Testing Black Box Testing White Box Testing • *or Breadth of Testing vs. Depth of Testing as detailed in Department of Army Pamphlet 73-1
- 3. 18 times n It is IMPOSSIBLE to test All Statistical Paths n So, from structural coverage view, When Should We Stop Testing? n Not care? (planes do, missiles do) n All lines? n All branches? n All cyclomatic paths? 18 0 10Optimum Number of Tests? All Statistical Paths = 10 18 If allow 1 Nanosecond per test, time is : T = 10 x 3600 x 24 x 365 9 10 18 = 31.7 Years IV. Testing Software for Reliability - Structured Testing Impossibility of Testing Everything
- 4. A complexity measure •Definition: The cyclomatic number v(G) of a graph G with e edges, n nodes, and p connected components is e-n+p. •Theorem: In a strongly connected graph the cyclomatic number is equal to the maximal number of linearly independent circuits.
- 5. With this example • V(G) = 10 – 6 + 1 = 5 • # of regions = 5
- 6. Pick paths for the 5 circuits • Using theorem 1 we choose a set of circuits that are paths. The following set B is a basis set of paths. • B: (abef) , (a(be)2f) , ((abe)2f) , (acf) , (adcf) • Linear combinations of paths in B will generate any path. For example, • (abea(be)3f) = 2(a(be)2f) – (abef) • (a(be)2abef) = (a(be)2f)+((abe)2f)-(abef)
- 7. Methods of computing v(G) • E-n+2 • # decisions + 1 • # of regions in a planar flow graph
- 8. 8 Function A Complexity = 20 5.17s Unstructuredness (evg) = 1 Function B Complexity = 18 Unstructuredness (evg) = 17 So B is MUCH harder to maintain! Complexity (decisions) & # lines here are similar, but ...
- 9. Applications Testing Essential complexity --- reverse engineering Design Complexity ---- system integration Data complexity --- Y2K testing Pareto Distribution of errors --- reverse engineering Code Breaker ---- Reuse Security threats Data Slicing ----- Reuse Code walkthroughs ---- validation Design validation Requirements Validation
- 10. Google book search – McCabe Complexity – 22,000 books
- 11. Google web search (McCabe complexity): 456,000 references In 2009 Tom McCabe’s publication on Software Complexity was chosen as one of the retrospective 23 highest impact papers in computer science by the ACM-SIGSOFT

No public clipboards found for this slide

Be the first to comment