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
テスト駆動開発 輪読会 vol.2 / TDD Reading Session
Search
makasn
July 15, 2020
Programming
160
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
テスト駆動開発 輪読会 vol.2 / TDD Reading Session
makasn
July 15, 2020
Other Decks in Programming
See All in Programming
Vue Fes Japan の “作る側”に関わってみて
naokihaba
0
140
速く作れる。その次は、速く確かめられる開発へ 〜AIネイティブ開発を支える、Shift Down〜 / Can build fast. Next, moving to development where we can verify fast.
rkaga
8
5.7k
AIに “答え“を書かせるのを やめてみた
___akari11
0
120
Kubernetes祭り #2 OP/ED
bells17
0
110
The Rails Doctrine Decade
koic
2
550
HTML-in-Canvasで作る未来のWeb UI表現
clockmaker
3
4.2k
Apple Intelligence を用いた個人情報誤送信防止、及びユーザーリクエスト体験の改善について
yukiny
0
330
Streamlitで実現する自然言語データアプリ開発
ayumu_yamaguchi
1
360
Are APIs Still Relevant in the AI Era?
soyuka
0
450
Agentic Software Factoryに、すごく賢いIF文を。 / super smart IF statement into the Agentic Software Factory.
rkaga
8
2.1k
AI が書く Go コードの品質を劇的に向上させる Linter: “declscope”
mpyw
0
490
Everything will be SERVERLESS — 信じて運用した10年の経験値 / Everything Will be Serverless — Lessons Learned from 10 Years of Operational Experience
seike460
PRO
1
960
Featured
See All Featured
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
350
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
68
58k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.2k
Large-scale JavaScript Application Architecture
addyosmani
516
110k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
400
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
550
The Pragmatic Product Professional
lauravandoore
37
7.5k
Test your architecture with Archunit
thirion
2
2.4k
Building a Scalable Design System with Sketch
lauravandoore
464
34k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Transcript
テスト駆動開発 輪読会 vol.2 6章〜11章 2020年07月15日 by makasn
前回のおさらい • TDDにおけるシンプルなルール ◦ 自動化されたテストが失敗したときのみ、新しいコードを書く ◦ 重複を除去する • 仮実装と明白な実装を行き来しながら進めていくのが良い •
コードを一般化できるのは2つ以上の実例があるときだけ • 意図を語るテストを書こう • 動かしてから正しくしていくために、原則を一度破る
第6章 テスト不足に気づいたら • 素早く先に進むために多くのコードをコピー&ペーストしてきたため、コード をきれいにする段階にやってきた • テストが十分に書かれていないコードを相手にTDDを行う場合、あればよ かったと思うテストを書こう
第7章 疑念をテストに翻訳する • 頭の中にある疑念をテストとして表現する • 完璧ではないもののまずまずのやり方でテストを通す • さらなる設計は本当に必要になるときまで先延ばしにする
第8章 実装を隠す • 我々は型に弱い... • 重複を除去できる状態に一歩近づけた • メソッド宣言だけは親クラスに移動 • Factory
Methodパターンでテストコードから2つのサブクラスの存在を隠し た
第9章 歩幅の調整 • TDDを行う際には歩幅を微調整する ◦ 非常に細かなステップを窮屈に感じるなら歩幅を大きくする ◦ 不安を感じるならば歩幅を小さくする • 完全に同じ内容になったメソッドを親クラスへ引き上げていく
第10章 テストに聞いてみる • レッドバーが出ている時に新しくテストを加えるのは避けたい ◦ 手堅い方法は、レッドバーの原因になった変更を巻き戻し、グリーン バーに復帰すること • しかし我々PHPerは最終的にdollarメソッドとfrancメソッドでMoneyにキャ ストできてないからエラー出てますよね。。
第11章 不要になったら消す • コンストラクタだけになったDollarとFrancを消す • ここでようやくテストが通るようになる • 冗長になってしまうテストたちを消す
まとめ • 一貫して小さなステップで進めるのがTDDの醍醐味なんだなと感じた。 • 頭の中にある疑念をテストとして表現することや、レッドバーの原因になっ た変更を巻き戻し、グリーンバーに復帰することが大事。 • PHPではここまで型の恩恵を受けていない分、どうしてもステップが少し大 きめになってしまうのかもしれないと思った