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
refactoring
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
mazua
August 20, 2021
Programming
22k
1
Share
refactoring
mazua
August 20, 2021
More Decks by mazua
See All by mazua
初めてのPHP.pdf
azuma
0
22k
Other Decks in Programming
See All in Programming
How We Benchmarked Quarkus: Patterns and anti-patterns
hollycummins
1
170
How Swift's Type System Guides AI Agents
koher
0
320
アクセシビリティ試験の"その後"を仕組み化する
yuuumiravy
1
190
Agentic Elixir
whatyouhide
0
430
決定論 vs 確率論:Gemini 3 FlashとTF-IDFを組み合わせた「法規判定エンジン」の構築
shukob
0
140
実践CRDT
tamadeveloper
0
610
Back to the roots of date
jinroq
0
610
AI時代のPhpStorm最新事情 #phpcon_odawara
yusuke
0
250
When benchmarks go bad - what I learned from measuring performance wrong
hollycummins
0
240
Cache-moi si tu peux : patterns et pièges du cache en production - Devoxx France 2026 - Conférence
slecache
0
320
PHPer、Cloudflare に引っ越す
suguruooki
1
130
How We Practice Exploratory Testing in Iterative Development( #scrumniigata ) / 反復開発の中で、探索的テストをどう実施しているか
teyamagu
PRO
2
390
Featured
See All Featured
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.9k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
122
21k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
130
[SF Ruby Conf 2025] Rails X
palkan
2
1k
From π to Pie charts
rasagy
0
180
Optimizing for Happiness
mojombo
378
71k
4 Signs Your Business is Dying
shpigford
187
22k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.9k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.7k
For a Future-Friendly Web
brad_frost
183
10k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.5k
Color Theory Basics | Prateek | Gurzu
gurzu
0
300
Transcript
リファクタリング 既存のコードを安全に改善する 意図が伝わるコードの書き方
リファクタリングとは? • プログラムの振る舞い(仕様)を変えずに内部品質を向上させる作業 • 内部品質: 保守性、可読性等 • バグ修正ではない(リファクタリングとバグ修正は別で行う) • 実現方法:
カプセル化、関数化、名前の変更等
ロジックを関数化する目的とは? 1. 再利用性を高める(同じ処理を繰り返し書かない) 2. 可読性を上げる(行数を減らす) 3. 意図を明確にする(何をやっているかを読み手に伝える)
サンプルコード(リファクタリング前) ※ if文の条件が長くなると単純に読み辛く、理解しづらいという問題も つまりどういうことだってばよ?
サンプルコード(リファクタリング後) 曜日判定ロジックを 別関数に抽出 週末は割増料金になることをより明確に表現 ※ ユニットテストのしやすさも向上
関数命名のセオリー 「実装」と「意図」を分離する つまり「どうやって処理を行っているか」ではなく 「何をしているか」に着目して命名する × isDayOfWeekZeroOne() ◦ isWeekend()