Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Cyclomatic Complexity
Search
Anna Filina
October 08, 2016
Programming
320
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Cyclomatic Complexity
Don’t write unnecessary tests anymore. Use a simple, scientific approach.
Anna Filina
October 08, 2016
More Decks by Anna Filina
See All by Anna Filina
Surviving a Symfony Upgrade
afilina
1
220
Upgrading Legacy to the Latest PHP Version
afilina
1
250
Better Code Design in PHP
afilina
0
330
Semi-Automated Refactoring and Upgrades with Rector
afilina
0
240
Better Code Design in PHP
afilina
1
500
Better Code Design in PHP
afilina
0
670
Adding Tests to Untestable Legacy Code
afilina
0
460
Upgrading Legacy to the Latest PHP Version
afilina
0
460
Semi-Automated Refactoring and Upgrades with Rector
afilina
0
360
Other Decks in Programming
See All in Programming
Modernizing iOS Apps
seyfoyun
0
140
AIが生成したコードは読むべきか?抽象化設計とコードの品質保証 / abstraction-design-and-quality
minodriven
12
8k
作れる、でも消せるか?──安全に「枯らして消す」機能削除術 / Drain, Then Delete
chobishiba
3
1.3k
baseline으로 마이그레이션, 리팩토링 안전하게 맡기기
fornewid
1
770
GraphQL の onError と Nullability のこれから
quramy
0
200
當我們開始不讀 Code - AI Agent 時代,Code Review 與 Clean Code 還剩下什麼?
jame2408
1
350
動画プレイヤーはなぜカクつくのか 〜Flutterのレンダリングとネイティブの境界を解剖する〜
naruogram
0
310
Spec-driven Development with AI
simas
PRO
0
2.2k
[JA] Domain Modeling with Vanilla Rails: 「操作」から再考するRailsの設計論
yasaichi
4
1.5k
社内AIエージェント「Askワンバン」における コストチューニングの取り組み
t0yohei
0
120
[2026-10-09]一枚の布で作らなくてもいい。 信頼性は「パッチワーク」で紡がれる~既存の運用と新しい可能性をつなぎ合わせてきたCREの話~
tosite
0
120
個人開発者よ、Honoを使え(おじさんver)
tanahiro2010
2
300
Featured
See All Featured
What does AI have to do with Human Rights?
axbom
PRO
1
2.5k
Marketing to machines
jonoalderson
1
6k
Practical Orchestrator
shlominoach
192
12k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
650
Amusing Abliteration
ianozsvald
1
370
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
74
43k
ラッコキーワード サービス紹介資料
rakko
5
5.6M
GitHub's CSS Performance
jonrohan
1033
470k
Music & Morning Musume
bryan
48
7.5k
How Software Deployment tools have changed in the past 20 years
geshan
2
35k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
320
Fantastic passwords and where to find them - at NoRuKo
philnash
53
4k
Transcript
foolab.ca | @foolabca Cyclomatic Complexity Bulgaria PHP, Sofia - October
8, 2016
Execution Paths public function getShipping() { if ($this->subtotal >= 40)
{ return 0; } return $this->standardShipping; } 2
Execution Paths public function getShipping() { if ($this->subtotal >= 40)
{ return 0; } return $this->standardShipping; } 3 Path 1 Path 2
Decision Branches 4 start product loop free shipping? end
Decision Branches 5 start product loop free shipping? end
Cyclomatic complexity = edges − nodes + 2 * connected
components
Decision Branches 7 start product loop free shipping? end ◦
Edges ◦ Nodes ◦ Connected components.
Decision Branches 8 start product loop free shipping? end ◦
Edges ◦ Nodes ◦ Connected components.
Decision Branches 9 start product loop free shipping? end ◦
Edges ◦ Nodes ◦ Connected components.
Cyclomatic complexity = 9 − 8 + 2 * 1
= 3
Zero Times foreach ($products as $product) { $total = $product->price
* $product->quantity; } $tax = $total * ... 11
Multiple Times $total = 0; foreach ($products as $product) {
$total = $product->price * $product->quantity; } $tax = $total * ... 12
Multiple Times $total = 0; foreach ($products as $product) {
$total += $product->price * $product->quantity; } $tax = $total * ... 13
@afilina afilina.com