Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Cyclomatic Complexity
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Anna Filina
October 08, 2016
Programming
0
290
Cyclomatic Complexity
Don’t write unnecessary tests anymore. Use a simple, scientific approach.
Anna Filina
October 08, 2016
Tweet
Share
More Decks by Anna Filina
See All by Anna Filina
Surviving a Symfony Upgrade
afilina
1
150
Upgrading Legacy to the Latest PHP Version
afilina
1
170
Better Code Design in PHP
afilina
0
290
Semi-Automated Refactoring and Upgrades with Rector
afilina
0
180
Better Code Design in PHP
afilina
1
450
Better Code Design in PHP
afilina
0
610
Adding Tests to Untestable Legacy Code
afilina
0
390
Upgrading Legacy to the Latest PHP Version
afilina
0
410
Semi-Automated Refactoring and Upgrades with Rector
afilina
0
310
Other Decks in Programming
See All in Programming
AIに任せる範囲を安全に広げるためにやっていること
fukucheee
0
130
PostgreSQL を使った快適な go test 環境を求めて
otakakot
0
560
AWS Infrastructure as Code の新機能 2025 総まとめ 〜SA 4人による怒涛のデモ祭り〜
konokenj
10
3.4k
Go 1.26でのsliceのメモリアロケーション最適化 / Go 1.26 リリースパーティ #go126party
mazrean
1
400
OTP を自動で入力する裏技
megabitsenmzq
0
110
Takumiから考えるSecurity_Maturity_Model.pdf
gessy0129
1
140
CS教育のDX AIによる育成の効率化
niftycorp
PRO
0
120
クライアントワークでSREをするということ。あるいは事業会社におけるSREと同じこと・違うこと
nnaka2992
1
340
「やめとこ」がなくなった — 1月にZennを始めて22本書いた AI共創開発のリアル
atani14
0
390
Codex の「自走力」を高める
yorifuji
0
1.2k
Claude Code の Skill で複雑な既存仕様をすっきり整理しよう
yuichirokato
1
380
CSC307 Lecture 15
javiergs
PRO
0
250
Featured
See All Featured
Thoughts on Productivity
jonyablonski
75
5.1k
From π to Pie charts
rasagy
0
150
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.2k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5.4k
[SF Ruby Conf 2025] Rails X
palkan
2
830
How to build a perfect <img>
jonoalderson
1
5.3k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
130
Mobile First: as difficult as doing things right
swwweet
225
10k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
110
The Curious Case for Waylosing
cassininazir
0
270
We Are The Robots
honzajavorek
0
200
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
190
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