Download - Testing Will Challenge Your Conventions
![Page 1: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/1.jpg)
チェックリストの12項目に該当したらTDD脳
XP祭り2007;江戸川区文化センター; 2007-09-01(土)
角谷 信太郎Testing Will Challange Your Conventions
[email protected](株)永和システムマネジメント
KAKUTANI Shintaro; Eiwa System Management, Inc.; a strong Ruby proponent
![Page 2: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/2.jpg)
角谷 信太郎✓ (株)永和システムマネジメント
✓ テスト駆動開発者✓ 日本Rubyの会理事✓ http://kakutani.com
![Page 3: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/3.jpg)
IPA未踏ソフトウェア創造事業2006年度下期千葉PM採択プロジェクト最終成果報告会
✓ Ruby1.9~これからのRuby~
✓ “エンタープライズ”の現場としてのRuby
✓ 2007.09.07(Fri)✓ http://www.mitou-chiba.org/
![Page 4: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/4.jpg)
『JavaからRubyへ』マネージャのための
実践移行ガイド
Bruce A. Tate 著角谷信太郎 訳オライリー・ジャパン 発行第3刷(fixed 78 bugs)
http://www.amazon.co.jp/o/ASIN/4873113202/kakutani-22
営業自重
またこのスライドか
宣伝乙
![Page 5: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/5.jpg)
Vol.40『WEB+DB PRESS』
連載 第2回載ってます:“アジャイル開発者の習慣 ~ acts_as_agile” 角谷信太郎
http://www.amazon.co.jp/o/ASIN/477413192X/kakutani-22
祝★40★号 祝★40★号 祝★40★号 祝★40★号
祝★40★号 祝★40★号 祝★40★号 祝★40★号
祝★40★号 祝★40★号 祝★40★号 祝★40★号
祝★40★号 祝★40★号 祝★40★号 祝★40★号
祝★40★号 祝★40★号 祝★40★号 祝★40★号
祝★40★号 祝★40★号 祝★40★号 祝★40★号
祝★40★号 祝★40★号 祝★40★号 祝★40★号
祝★40★号 祝★40★号 祝★40★号 祝★40★号
祝★40★号 祝★40★号 祝★40★号 祝★40★号
祝★40★号 祝★40★号 祝★40★号 祝★40★号
祝★40★号 祝★40★号 祝★40★号 祝★40★号
祝★40★号 祝★40★号 祝★40★号 祝★40★号
祝★40★号 祝★40★号 祝★40★号 祝★40★号
祝★40★号 祝★40★号 祝★40★号 祝★40★号
祝★40★号 祝★40★号 祝★40★号 祝★40★号
祝★40★号 祝★40★号 祝★40★号 祝★40★号
祝★40★号 祝★40★号 祝★40★号 祝★40★号
祝★40★号 祝★40★号 祝★40★号 祝★40★号
テラナオヤDave Thomas Tシャツ欲しい! とはてなキーワードに(ry
Vista怖えええええええええええ
びゃあ゛ぁ゛゛ぁうまひぃ゛ぃぃ゛
びゃあ゛ぁ゛゛ぁうまひぃ゛ぃぃ゛
![Page 6: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/6.jpg)
よろしくお願いします
![Page 7: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/7.jpg)
Test Driven Development
テスト駆動開発
![Page 8: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/8.jpg)
テスト駆動開発入門
http://www.amazon.co.jp/o/ASIN/4894717115/kakutani-22
![Page 9: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/9.jpg)
TDDは、✓ テスト技法ではない✓ 分析手法/設計技法であり、✓ 開発のあらゆるアクティビティを構造化するための技法
![Page 10: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/10.jpg)
開発のあらゆるアクティビティを
構造化する
![Page 11: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/11.jpg)
TDDは仕事と思考のスタイル
![Page 12: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/12.jpg)
まずはコードから
![Page 13: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/13.jpg)
今日の元ネタ
![Page 14: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/14.jpg)
Testing Will Challenge Your Conventions by Tim Ottinger
http://blog.objectmentor.com/articles/2007/07/17/testing-will-challenge-your-conventions
![Page 15: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/15.jpg)
チェックリストの12項目に該当したらTDD脳
![Page 16: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/16.jpg)
1.インターフェイスかわいいよインターフェイス 2.Singletonやstaticメソッドは好みじゃない 3.privateへの思い入れがなくなった 4.コンストラクタ引数にはコラボレータを渡したい 5.小さいメソッドが好き 6.引き継ぎ? テストコードはどこ? 7.自分の書いたコードの最初のユーザは自分だ 8.最適化を言い出すのはテストを揃えてから 9.テスト全体の実行速度に気を配る10.依存関係を少なくすることに気を配る11.「わかりやすい」ことがカッコイイ12.テスト実行を支援するIDEが良いIDE
![Page 17: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/17.jpg)
ひたすら紹介してくよ
![Page 18: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/18.jpg)
(1)
![Page 19: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/19.jpg)
1.インターフェイスかわいいよ インターフェイス✓ “インターフェイスに対してプログラミングする”✓ テストもプログラミングだよ
✓ テスト容易性ですよねー✓ Mock, Stub, DIコンテナ
![Page 20: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/20.jpg)
Rubyに無くね?✓ すべてがインターフェイス✓ Duck Typing✓ インターフェイスは空気✓ カッコいいMock/Stubライブラリたち
![Page 21: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/21.jpg)
(2)
![Page 22: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/22.jpg)
2.Singletonやstaticメソッドは 好みじゃない✓ だってテストしづらいもん✓ ほんとに必要かな?✓ テストできるなら使うけど✓ bliki:“staticの置き換え”✓ http://capsctrl.que.jp/kdmsnr/wiki/bliki/?StaticSubstitution
![Page 23: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/23.jpg)
(3)
![Page 24: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/24.jpg)
3. privateへの思い入れが なくなった✓ だってテストしづらいもん✓ インターフェイスが”public”✓ “published”✓ 実装クラスが”private”✓ テストの資産価値との関連
![Page 25: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/25.jpg)
(4)
![Page 26: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/26.jpg)
4.コンストラクタ引数には コラボレータを渡したい✓ 協調するオブジェクトを自分で生成しない✓ だってテストしづらいもん✓ 単一責務の原則(SRP)✓ DIコンテナ
![Page 27: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/27.jpg)
(5)
![Page 28: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/28.jpg)
5.小さいメソッドが好き✓ だってテストしづらいもん✓ 10行を越えると大きいよね✓ メソッドが小さいと、それぞれのテストも小さくなる✓ 数は増えちゃうかもしれないけど ✓ 極端に短いとかはまた別の話
![Page 29: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/29.jpg)
(6)
![Page 30: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/30.jpg)
6.引き継ぎ? テストコードはどこ?✓ コメントよりもテストコード✓ テスト容易性にはテストコードの読みやすさも含まれるよ✓ ドキュメントのようなコードを書きたい
![Page 31: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/31.jpg)
(7)
![Page 32: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/32.jpg)
7.自分の書いたコードの最初の ユーザは自分✓ 自分の書いたコードのテストを書くのは自分だもん✓ 自分がテストしづらいコードは他の人にも使いづらいはず✓ 使いやすいAPIを設計したい
![Page 33: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/33.jpg)
(8)
![Page 34: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/34.jpg)
8.最適化を言い出すのは テストを揃えてから✓ 速さとテスト容易性とでは、 まずテスト容易性を選ぶ✓ 最適化の第1原則: 最適化するな✓ 最適化の第2原則: まだ最適化するな✓ プロファイリング
![Page 35: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/35.jpg)
(9)
![Page 36: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/36.jpg)
9.テスト全体の実行速度に気を 配る✓ 頻繁に実行したいじゃない?✓ 実行速度の目安:✓ Red/Green/Refactorのサイクルで1秒✓ ユニットテスト全体で20~30秒✓ 「10分ビルド」
✓ 遅いテストは別実行(それCIで)
![Page 37: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/37.jpg)
(10)
![Page 38: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/38.jpg)
10.依存関係を少なくすること に気を配る✓ だってテストしづらいもん✓ 小さなクラスをたくさん定義することを躊躇しない✓ 協調を担当するクラスと、 実装を担当するクラス
![Page 39: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/39.jpg)
(11)
![Page 40: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/40.jpg)
11. “わかりやすい”ことが カッコイイ✓ “わかりやすさ”は“巧妙さ”に 200倍勝る✓ だってテストしづらいもん✓ リファクタリングしやすい✓ 意図が明瞭なテストコード
![Page 41: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/41.jpg)
(12)
![Page 42: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/42.jpg)
12. テスト実行を支援するIDE が良いIDE✓ 開発とはテストの実行である✓ モダンIDE✓ Eclipse,NetBeans,IDEA✓ Visual Studioも?
✓ Emacs, Vim
![Page 43: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/43.jpg)
まとめ✓ TDDは仕事と思考のスタイル✓ TDD脳チェックリスト12項目✓ 短いので原文も読んでね✓ 営業自重
![Page 44: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/44.jpg)
ご清聴ありがとうございました
![Page 45: Testing Will Challenge Your Conventions](https://reader034.vdocuments.us/reader034/viewer/2022051411/54812700b4af9fe2158b5f48/html5/thumbnails/45.jpg)
Happy Testing!