Upgrade to Pro — share decks privately, control downloads, hide ads and more …

TDDの練習 Coding Kata の実践

TDDの練習 Coding Kata の実践

hakobe (Yohei Fushii)

April 19, 2014
Tweet

More Decks by hakobe (Yohei Fushii)

Other Decks in Programming

Transcript

  1. Coding Kata TDD practice with

  2. hakobe hatena: id:hakobe932 twitter: @hakobe github: @hakobe

  3. TDD Test Driven Developement

  4. –Robert C. Martin “ཁ͢ΔʹTDD͸ϓϩͷબ୒ͳͷͩɻ ࣮֬ੑɾܽؕࠞೖ཰ͷ௿Լɾ༐ؾɾ
 υΩϡϝϯτɾઃܭΛଅਐ͢Δن཯ͩɻ”

  5. ϓϩͳΒ͹TDDΛ࢖͏

  6. TDDͷࡾݪଇ 1. ࣦഊ͢ΔςετΛॻ͘·Ͱ
 ϓϩμΫγϣϯίʔυΛॻ͔ͳ͍ 2. ࣦഊͤ͞Δ໨తҎ֎ͰςετΛॻ͔ͳ͍ 3. ࣦഊ͢Δςετ͕੒ޭ͢Δ·Ͱ
 ଞͷϓϩμΫγϣϯίʔυΛॻ͔ͳ͍

  7. Red Green Refactoring TDDͷ αΠΫϧ

  8. ࣮ફͰ͖ͯΔ? •͸͡ΊʹςετΛॻ͘บ͸Ͱ͖ͯΔ? •͏·͘αΠΫϧΛ·ΘͤͯΔ? •ςετॻ͘ͷ೉͍͠෦෼΋ॻ͚Δ? •Fake It / Obvious Implementation /

    Triangulation ͏·͘Ͱ͖ͯΔ?
  9. ࿅श

  10. Coding Kata

  11. Coding Kata ۭखͷܕʹͳͧΒ͑ͨɺϓϩάϥϛϯάͷ࿅शํ๏ɻ ! جຊతͳ՝୊Λ܁Γฦ͠࿅श͢Δ͜ͱͰɺ TDDͷΑ͏ͳن཯΍ɺΤσΟλͷૢ࡞ํ๏ɺ Α͋͘Δ໰୊ͷղܾखॱͳͲΛମʹછΈࠐ·ͤΔɻ

  12. Ϙ΢ϦϯάήʔϜ ‣10ϑϨʔϜ x ࠷େ 2 ౤ͯ͠ 10 ݸͷϐϯΛ౗͢ ‣ετϥΠΫ Ϙʔφε:

    ࣍ͷ 2 ౤ͷ౗ͨ͠ϐϯ਺ ‣εϖΞ Ϙʔφε: ࣍ͷ 1 ౤ͷ౗ͨ͠ϐϯ਺ ‣10ϑϨʔϜ໨ εϖΞ͔ετϥΠΫ͕ग़ͨΒ࠷େ3౤Ͱ͖Δ
  13. ཁٻ࢓༷ •roll(pins: Int) ϓϨΠϠʔ͕ϘʔϧΛ౤͛ͨ࣌ʹݺ͹ΕΔɻ
 Ҿ਺͸౗ͨ͠ϐϯ਺ɻ •score(): Int ͜ͷήʔϜͷείΞΛฦ͢ Game +

    roll(pins: Int) + score(): Int
  14. ࣮ԋ Scala/spec2/IntelliJ/sbt

  15. ·ͱΊ • TDD͸ϓϩͷश׳ • Coding KataͰ࿅शͯ͠਎ʹ͚ͭΑ͏ ࣮ࡍ͏·͍ͬͯ͘Δ? - TDDͷϦζϜ͕਎ʹͭ͘ -

    ։ൃ؀ڥྑ͘ͳΔ - ϓϩάϥϛϯάݴޠͷػೳΛֶ΂Δ
  16. ࢀߟจݙ • ΞδϟΠϧιϑτ΢ΣΞ։ൃͷԞٛ
 (ISBN: 978-4797347784) • ε͸εϖοΫͷε ʲୈ 1 ճʳ

    RSpec ͷ֓ཁ ͱɺRSpec on Rails (Ϟσϧฤ)
 ( http://magazine.rubyist.net/?0021-Rspec ) • ͜ͷൃදͷαϯϓϧίʔυ ( https:// github.com/hakobe/coding-kata-bowling )