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

My_TDD.pdf

 My_TDD.pdf

110cd4dcaed019b3bd9809e541afdeb6?s=128

Masafumi Okura

February 11, 2020
Tweet

Transcript

  1. My TDD Speaker: େ૔խ࢙ Event: େߐށRubyձٞ08 Date: 2020-02-11

  2. ϝλ • εϥΠυຕ਺ɿ44ຕ • ൃද࣌ؒɿ20෼ • σϞɿ༗Γ

  3. okuramasafumi.inspect • ໊લɿେ૔խ࢙ • ॴଐɿϑϦʔϥϯε • ίϛϡχςΟɿGrow.rbओ࠵ɺͦͷଞଟ਺ࢀՃ • Rubyྺɿ໿7೥ •

    झຯɿϓϩάϥϛϯάɺొஃɺᘖᘣɺӳޠ
  4. ໨࣍ 1. My TDD (first part) 2. My gem 3.

    My TDD (second part) 4. ࠂ஌
  5. 1. My TDD (first part)

  6. झຯɿϓϩάϥϛϯά

  7. ϓϩάϥϛϯά͸ָ͍͠

  8. Ͱ΋ɺଞʹ΋༠࿭͕ଟ͍

  9. ͦ͜Ͱ…

  10. TDD ➡

  11. TDD ➡ Todan Driven Development

  12. झຯɿొஃ

  13. ࣗ෼ͷ࡞Διϑτ΢ΣΞʹ͍ͭͯൃද͢Δ ͜ͱͰ։ൃʹϓϨογϟʔΛ͔͚Δ

  14. ࠓͷॴͱͯ΋ޮՌ͕͋Δ

  15. ͜Ε͕ࢲͷTDD

  16. ༨ஊɿ ඈߦػ΍৽װઢͷத͸࠷ߴͷϓϩάϥϛϯ ά؀ڥ

  17. ༨ஊͷ༨ஊɿ ࠓ೥͸طʹ৽װઢʹ1ճͱඈߦػʹ2ճ৐ͬ ͍ͯ·͢ɻ͍ͩͿḿΓ·ͨ͠ɻ

  18. ͞Βʹ༨ஊɿ ։ൃΛਐΊΔͨΊͷख๏ͱͯ͠ɺTODO͕ ࣌ݶര஄ʹͳΔΑ͏ͳgemΛॻ͍͍ͯΔਓ ͕͍·ͨ͠Ͷʢૉఢʣ

  19. ༨ஊऴΘΓ

  20. ࠓ೔఻͍͑ͨ͜ͱͦͷұ • ϓϩάϥϛϯά͸ָ͍͠ • ొஃ͸ָ͍͠ • ૊Έ߹ΘͤͨΒ࠷ڧͰ͸ʁ • ΈΜͳ΋ͲΜͲΜొஃͯ͠ͲΜͲΜίʔυॻ͜͏

  21. ͰɺԿΛ࡞͍ͬͯΔΜͰ͔͢ʁ

  22. 2. My gem

  23. JSONγϦΞϥΠβΛ࡞͍ͬͯ·͢ɻ

  24. طଘͷJSONγϦΞϥΠβͷ͜ͱ • jbuilderɿ஗͍ɺDSL݁ߏ೉͍͠ • ActiveModelSerializersɿϝϯς͞ΕͯΔͷ͔Θ͔Βͳ͍ɺ಺ ෦ߏ଄ෳࡶɺ͋·Γ଎͘ͳ͍ • fast_jsonapiɿ଎͍͚ͲJSON:APIܗ͔ࣜ͠αϙʔτ͠ͳ͍

  25. γϯϓϧͰɺϝϯς͕؆୯Ͱɺ DSL͕֮͑΍ͯ͘͢ɺͦͦ͜͜଎͍ɺ JSONγϦΞϥΠβΛ࡞Γ͍ͨʂ

  26. Alba https://github.com/okuramasafumi/alba

  27. 0.1.0૬౰ͷ΋ͷ͕Ͱ͖ͨؾ͕͍ͯ͠·͢

  28. ͳͷͰɺϦϦʔε͠·͢

  29. Albaͷػೳʢࠓ೔࣌఺ʣ • JSONͷϧʔτΩʔΛઃఆՄೳ • attributesϝιουͰJSONʹؚΊΔଐੑΛෳ਺ࢦఆՄೳ • attributeϝιουͰJSONʹؚΊΔଐੑΛϒϩοΫͰࢦఆՄೳ • JSONͷόοΫΤϯυʹOjΛࢦఆՄೳ

  30. ࠓ೔఻͍͑ͨ͜ͱͦͷ್ • Alba͍ͬͯ͏gemΛ࡞͍ͬͯ·͢ • ػೳ͸·ͩશવ଍Γͳ͍͚Ͳɺ͜Ε͔ΒΨγΨγ௥Ճ͍ͨ͠ • طଘͷ΋ͷʹෆຬ͕͋ΔͳΒ࡞Ε͹͍͍͡Όͳ͍ • ௥Ճ͢΂͖ػೳʹ͍ͭͯͷҙݟɺ͓଴͍ͪͯ͠·͢

  31. ۤ࿑ͨ͠఺ • ΫϥεϝιουͷDSLͰઃఆͨ͠৘ใΛΠϯελϯε͔Βࢀর ͢ΔΑ͏ʹ͢Δ࢓૊Έ • ࣮ޮੑ͕͋Δఔ౓͋ΔςετΛॻ͘͜ͱ • શମతͳUIͱઃܭ

  32. ςετͱUI

  33. 3. My TDD (second part)

  34. طଘͷϥΠϒϥϦʹ໰୊఺Λײ͡Δ ≠ ͲΜͳ;͏ʹվળ͢Ε͹͍͍͔Θ͔Δ

  35. ςετΛॻ͖ͳ͕Β୳͍ͬͯ͘

  36. TDD ➡ Test Driven Development

  37. ࢲͷ࠾༻ͨ͠ํ๏ • ·ͣϢʔεέʔεͷςετΛॻ͘ʢ࢓༷ࡦఆʣ • ͳΜ͔ҧ࿨ײ͕͋ͬͨΒςετΛॻ͖௚͢ʢ࢓༷มߋʣ • ςετʹೲಘ͕͍ͬͨΒ࣮૷͢Δ • ࣮૷͕ऴΘͬͨΒݸผͷΫϥεͷςετΛޙ͔Β௥Ճ͢Δʢ࣮ ͸·ͩॻ͍ͯͳ͍ʣ

  38. ϘτϜΞοϓͰ͸ͳ͘τοϓμ΢ϯ

  39. ͜Ε͕ࢲͷTDD

  40. ࠓ೔఻͍͑ͨ͜ͱͦͷࢀ • ࢓༷ͱ͔ɺͲ͏͍͏ΠϯλʔϑΣʔε͕ཧ૝͔ͳΜͯͦ͏؆୯ ʹ͸Θ͔Βͳ͍ • ϢʔεέʔεΛςετԽͯ͠ɺೲಘߦ͘·Ͱॻ͘ • Ϣχοτςετ͸ޙ෇͚Ͱ͍͍ͷͰ͸

  41. 4. ࠂ஌

  42. None
  43. https://kaigionrails.org

  44. ·ͱΊ • ϓϩάϥϛϯάͱొஃ͸ָ͍͠ɺ૊Έ߹ΘͤΔͱ΋ͬͱָ͍͠ • Alba͍ͬͯ͏gemɺ࡞ͬͯ·͢ • τοϓμ΢ϯͰϢʔεέʔε͔ΒςετΛॻ͘ͱ͍͍͔΋ • Kaigi on

    Railsɺ΍Γ·͢