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

Octocatは技術的負債の夢を見るか?

 Octocatは技術的負債の夢を見るか?

2018/07/13
Rails Developers Meetup 2018 Day 3 Extreme
https://techplay.jp/event/679666

B7bf4e80841a44f921665e88d874f2c3?s=128

Hiroaki Ninomiya

July 13, 2018
Tweet

More Decks by Hiroaki Ninomiya

Other Decks in Technology

Transcript

  1. Octocat͸ٕज़తෛ࠴ͷເΛ ݟΔ͔? 2018/07/13 @treby006 Rails Developers Meetup Day3

  2. ࣗݾ঺հ • treby (@treby006) Shinjuku.rb • Reproגࣜձࣾ Dev2νʔϜϦʔμʔ • RailsͰ৽͍͠ػೳΛ࡞ͬͨΓɺطଘػೳͷ

    վળͨ͠Γ͍ͯ͠Δͱ͜Ζ • Rails, Vue.js, AWS(ECS, EMR), Go
  3. ReproͷϦϙδτϦ • Railsͷίʔυϕʔε • Πϯϑϥίʔυ؅ཧ • ӡ༻εΫϦϓτྨ • ͳͲͳͲ

  4. ReproͷϦϙδτϦ • Railsͷίʔυϕʔε • Πϯϑϥίʔυ؅ཧ • ӡ༻εΫϦϓτྨ • ͳͲͳͲ

  5. աڈҰ೥ؒͷCommit਺ 2Ґ

  6. աڈҰ೥ؒͷAdditions/Deletions਺ 1Ґ (෼͔ΓͮΒ͍υϠϦϯά)

  7. ReproͷϦϙδτϦ • Railsͷίʔυϕʔε • Πϯϑϥίʔυ؅ཧ • ӡ༻εΫϦϓτྨ • ͳͲͳͲ •

    େମ CTOͷਓ͕Contribute্Ґ ʹ͍ΔϠόΠ
  8. Reproͷ͝঺հ

  9. We are hiring!! • ΞϐʔϧϙΠϯτ • େن໛σʔλ / B to

    B ͳΒͰ͸ͷݻ͞ • َͷΑ͏ʹίʔυ͕ॻ͚Δ • ఆ࣌ͷ֓೦͕ͳ͍ • ෰૷ࣗ༝ʗϦϞʔτϫʔΫࣗ༝ • Conferenceνέοτ୅͕ग़Δ
  10. ͳʹͱͧͳʹͱͧ

  11. ຊ୊: ٕज़తෛ࠴

  12. ٕज़తෛ࠴ͱ͸ ٕज़తෛ࠴ʢӳ: Technical debtʣͱ͸ɺߦ͖౰ ͨΓ͹ͬͨΓͳιϑτ΢ΣΞΞʔΩςΫνϟͱɺ ༨༟ͷͳ͍ιϑτ΢ΣΞ։ൃ͕Ҿ͖ى݁͜͢Ռͷ ͜ͱΛࢦ͢৽͍͠ൺᄻͰ͋Δ ʮઃܭ্ͷෛ࠴(design debt)ʯͱ΋ݴ͏ɻ ----

    Wikipediaʮٕज़తෛ࠴ʯΑΓ
  13. Կؾͳ͘࢖͏༻ޠ͚ͩͲ • ࣮͸ͦͷ࣮ମΛ௫Έ͖Ε͍ͯͳ͍ • ΤϯδχΞʮ͋ʔͳΔ΄ͲͶʯ • ҰํɺϏδωε্ͷϦεΫ͕෼͔ΓͮΒ͍ • ٕज़తෛ࠴Λ࿦͡Δલʹٕज़తෛ࠴Λ஌Βͳ͚ Ε͹ͳΒͳ͍

  14. ੔ཧͯ͠Έͨ

  15. ੔ཧͯ͠Έͨ

  16. ٕज़తෛ࠴ • ݏͩɺͳ͍ͨ͘͠ • ଟ෼޷͖ͳਓ͸͍ͳ͍

  17. ٕज़తෛ࠴ • ݏͩɺͳ͍ͨ͘͠ • ଟ෼޷͖ͳਓ͸͍ͳ͍ • ͳͥʁ => ֐͕͋Δ͔Β •

    ͲΜͳʁ
  18. ٕज़తෛ࠴ʹΑΔฐ֐ • ੬͍ઃܭ • อकੑͷ௿Լ • Ϟνϕʔγϣϯͷ௿Լ(։ൃޮ཰ͷ௿Լ) • νʔϜͷ݈߁ੑͷ௿Լ •

    ཭৬ɾ࠾༻೉ • ࣄۀͷࣦഊ
  19. ٕज़తෛ࠴ͱݺ͹ΕΔ΋ͷ • छྨ • ͍ΘΏΔΫιίʔυ • εέʔϧ͠ͳ͍ΞʔΩςΫνϟ • ͜͜·Ͱམͱͤ͹۩ମྫΛ૝૾͠΍͍͢ •

    ࠓճ͸ɺಛʹίʔυ࣮૷ʹϑΥʔΧε
  20. Ξϯνύλʔϯ(Railsฤ)

  21. έʔε1 ಠࣗDSL/ϑϨʔϜϫʔΫΛΞϓϦέʔγϣϯίʔ υʹೖΕΔ class SomeDSL def self.configulation(*args) end module Definition

    def provide(&definition) end end : : end
  22. ಠࣗDSL/ϑϨʔϜϫʔΫΛΞϓϦέ ʔγϣϯίʔυʹೖΕΔ • 0 → 1ͷϑΣʔζͰ΍Γ͕ͪ • େ఍όάϑΟΫε΍ػೳ௥ՃͷϫʔΫΞϥ΢ϯ υ͕ੵΈॏͳͬͯݟ௨͠ѱ͘ͳΔ •

    ͦͷ෦෼͕ຊ౰ʹރΕ͍ͯΕ͹໰୊ʹͳΒ ͳ͍͜ͱ΋͋Δ͕……
  23. ಠࣗDSL/ϑϨʔϜϫʔΫΛΞϓϦέ ʔγϣϯίʔυʹೖΕΔ • ։ൃऀࣗ਎͕खΛೖΕ΍͍͢ͷ͕·͍ͣ • ͦͷ࣌୲౰͍ͯ͠Δػೳ։ൃϕʔεͰमਖ਼Ͱ ͖Δ • ౰ॳ͋ͬͨ͸ͣͷDSL/ϑϨʔϜϫʔΫͷࢥ ૝͕յΕΔ

  24. ಠࣗDSL/ϑϨʔϜϫʔΫΛΞϓϦέ ʔγϣϯίʔυʹೖΕΔ • ָ͍͠RubyͱͷτϨʔυΦϑ • ॻ͖ͨ͘ͳΔ͚ͲνʔϜ։ൃͰ͸߇͑ͨ΄ ͏͕ແ೉ • gemͱͯ͠OSSެ։ͷํ͕݈શ

  25. έʔε2 ੹຿͕ᐆດͳ૚ΛऔΓೖΕͯ͠·͏ class SomeController < ApplicationController : : def create

    @presenter = SomePresenter.new(@some_model) if @presenter.save redirect_to :some_path else render :new end end end
  26. έʔε2 class SomePresenter < PresenterBase attr_reader :form delegate :save, to:

    :form def initialize(some_model) @form = SomeForm.new(some_model.attributes, self) end : : end
  27. έʔε2 class SomeForm < FormBase validate :something : : def

    initialize(params) : : end end
  28. ੹຿͕ᐆດͳΫϥεΛऔΓೖΕͯ͠· ͏ • ͍ΘΏΔࣅඇαʔϏεΫϥε • RailsͷϨʔϧʹ৐͍ͬͯͳ͍෦෼ • Կͷ໰୊΋ͳ͍Α͏ʹݟ͑Δ • ͕ɺෳ਺ਓͰ։ൃΛଓ͚ͯΔͱ……

  29. SomeForm : Before class SomeForm < FormBase validate :something :

    : def initialize(params) : : end end
  30. SomeForm : After class SomeForm < FormBase validate :something :

    : attr_reader :presenter def initialize(params, presenter) : @presenter = presenter : end def validate presenter.some_methods super end end
  31. Presenter : Before class SomePresenter < PresenterBase attr_reader :form delegate

    :save, to: :form def initialize(some_model) @form = SomeForm.new(some_model.attributes, self) end : : end
  32. Presenter : After class SomePresenter < PresenterBase attr_reader :form def

    initialize(some_model) @form = SomeForm.new(some_model.attributes, self) end def save : @form.save : end : : end
  33. ੹຿͕ᐆດͳΫϥεΛऔΓೖΕͯ͠· ͏ • ݁߹౓͸্͕Γଓ͚ɺΠϯελϯεͷ૬ޓࢀর ͕ൃੜ • Ͳ͜ʹॻ͚͹Α͍ͷ͔Θ͔Βͳ͍͠ɺͲ͜ ʹॻ͍ͯ΋Α͍ؾ͕ͯ͘͠Δ • ৮Γͨ͘ͳ͍͠ɺ৮ΔͱόάΔ

    ͷͰɺ࠷খͷ มߋͰٻΊΒΕ͍ͯΔཁ݅Λຬͨ͢Α͏ʹͳΔ • ׂΕ૭ཧ࿦
  34. ੹຿͕ᐆດͳΫϥεΛऔΓೖΕͯ͠· ͏ • ͜͏͍͏ͱ͜ΖʹݶͬͯɺϏδωεతʹίΞཁ ૉͩͬͨΓ͢Δ • ฐࣾͰ͍͏ͱϞσϧΛϑϩϯτ͔Β࡞੒͢Δ෦ ෼ʹଘࡏ͍ͯͨ͠ • ௚͢ͷʹ൒೥͘Β͍͔͔Γ·ͨ͠

    • ͠ɺ௧Έ΋͋ͬͨ
  35. ͱ͸͍͑ • ίʔυϨϏϡʔ΋ͯ͠Δ͠ɺCI΋ճ͍ͬͯΔ • ͦΕͰ΋ͳ͓ෛ࠴ͱݺ͹ΕΔ΋ͷ͕ੜ·Ε Δͷ͸ͳ͔ͥ

  36. ٕज़తෛ࠴͕ੜ·ΕΔཧ༝ • ҰݸਓʹىҼ • ࣌ؒෆ଍ • ٕज़ྗෆ଍ • ৸ෆ଍ •

    ͕ɺݱ࣮ʹ͸νʔϜ։ൃͰࣗ෼͕஌Βͳ͍͏ͪ ʹίʔυ͕มߋ͞Ε͍ͯΔͱ͍͏͜ͱ΋Α͋͘ Δ
  37. ࣄۀతʹՁ஋͕͋Δͱ͜Ζʹ ෛ࠴͸ཷ·Γ΍͍͢ • ࣄۀతʹՁ஋͕͋Δ • → ଟ͘ػೳཁ͕݅ೖΔ • → ଟ͘ͷϝϯόʔ͕मਖ਼͢ΔՄೳੑ͕͋Δ

    • → ͔ͭɺଟ͘ํ਑స׵͢ΔՄೳੑ͕͋Δ • ෳ਺ਓͰಉ͡ՕॴΛසൟʹ৮ΔͷͰɺٕज़తෛ ࠴͕ੜ·Ε΍͍͢
  38. ͖͞΄ͲͷΞϯνύλʔϯ • ࠷ॳͷίʔυ͕ॻ͔Εͨஈ֊ɿ ͻͲ͘ͳ͍ • αʔϏεΛਐΊΔ͋ΔλΠϛϯάͰੜ·Ε ͯ͠·ͬͨ΋ͷ • ٕज़తෛ࠴ͷΞϯνύλʔϯ =>

    ٕज़తෛ࠴ ΛੜΈग़͠΍ͯ͘͢͠͠·͏Ξϯνύλʔϯ • ٕज़తෛ࠴ΛੜΈग़͞ͳ͍ίʔυ͸ͳ͍ • αʔϏεΛ૸Βͤଓ͚ΔݶΓɺίʔυͷมߋ͸ ආ͚ΒΕͳ͍
  39. େࣄͳ͜ͱ͸ • ։ൃ଎౓Λग़͠ͳ͕Βɺػೳ௥ՃΛ͠ͳ͕Βί ʔυͷ݈߁ੑΛอͭ͜ͱ • ։ൃ(αʔϏε)͕ਐΉաఔͰίʔυશମΛ၆ ᛌ͢ΔػձΛઃ͚Δ͜ͱ • ͦΕͧΕҧ͏։ൃऀ͕ಉ͡໨ઢͰίʔυશ ମΛΈଓ͚Δ͜ͱ

  40. ٕज़తෛ࠴ : νʔϜ։ൃ

  41. ٕज़తෛ࠴Λ࡞Βͳ͍

  42. ٕज़తෛ࠴Λ࡞Βͳ͍

  43. ٕज़తෛ࠴ͱ޲͖߹͏

  44. ٕज़తෛ࠴͸ͳͥੜ·ΕΔͷ͔ • ෆ࣮֬ੑ΁ͷରॲͷࣦഊ • ࣗ෼ʹͱͬͯΘ͔Βͳ͍(ෆ࣮֬ͳ)΋ͷɿ ະདྷͱଞਓ • ͜ΕΒෆ࣮֬ͳ΋ͷʹରॲ͖͠Εͳ͔ͬͨ • νʔϜͱͯ͠ɺෆ࣮֬ੑʹͲ͏޲͖߹͍ͬͯ͘

    ͔
  45. ٕज़తෛ࠴ͷਖ਼ମ

  46. લʹਐΜͰ͍Δ͔Βͦ͜ͷٕज़తෛ࠴

  47. ͜Θ͘ͳ͍ٕज़తෛ࠴ • ͲΜͳʹࠅ͍ίʔυͰ΋ɺ͜ͷઌ͍͡Δ͜ͱ͕ ઈରʹͳ͍ͷͰ͋Ε͹ෛ࠴Ͱ͸ͳ͍ • ٕज़తෛ࠴ʹΑΔਏ͞ͷࠜݯ • ࠓͦͷ࣌ɺػೳΛ௥Ճ͠Α͏ͱͯ͠΋Ͱ͖ ͳ͍ʗͮ͠Β͍ͨΊ •

    ࠓͷ͜ͱ͕ࠓΑΓෆ࣮֬ͩͬͨաڈʹɺ΋͔͠ ͨ͠Βࣗ෼Ͱͳ͍ଞਓ͕ॻ͍ͨίʔυΛࠓ͍͡ Δͷ͕ਏ͍
  48. ະདྷ ͷෆ࣮֬ੑ͸୭ʹ΋ରॲ Ͱ͖ͳ͍

  49. ଞਓ ͷෆ࣮֬ੑ͸ϝιουͰ ղফͰ͖Δ͔΋͠Εͳ͍

  50. ଞਓͱͷؒͷෆ࣮֬ੑʹରॲ͢Δϝι ου • ରɾϏδωεαΠυ(ඇΤϯδχΞ) • ϢϏΩλεݴޠ • ରɾΤϯδχΞ • ઃܭ(஍ਤͷڞ༗)

  51. ଞਓͱͷؒͷෆ࣮֬ੑʹରॲ͢Δϝι ου • ରɾϏδωεαΠυ(ඇΤϯδχΞ) • ϢϏΩλεݴޠ • ରɾΤϯδχΞ • ઃܭ(஍ਤͷڞ༗)

    • ଞͷ෦෼ʹ͍ͭͯ͸લग़ͷຊ͕ৄ͍͠
  52. ஍ਤΛڞ༗͢Δ https://speakerdeck.com/joker1007/realworld- domain-model-on-rails

  53. ஍ਤΛڞ༗͢Δ https://speakerdeck.com/joker1007/realworld- domain-model-on-rails

  54. νʔϜͰ஍ਤΛڞ༗͢ΔͨΊʹ৺͕͚ ͍ͯΔ͜ͱ • ஍ਤ͕͢Ͱʹ͋Ε͹ • ڊਓͷݞͷ্ʹཱͭɿϨʔϧʹ৐Γଓ͚Δ • ஍ਤ͕ͳ͍ͷͰ͋Ε͹ • ஍ਤΛ࡞ͬͯ

    ෍ڭ͢Δ
  55. Ϩʔϧʹ৐Γଓ͚Δͱ͍͏બ୒ • Railsͷ͍͢͝ͱ͜Ζ • Ϩʔϧͱ͍͏໊ͷ஍ਤ͕޿͍ൣғͰڞ༗͞ Ε͍ͯΔ͜ͱ • CoC (Convention over

    Configuration) • RailsΤϯδχΞ͸RailsϓϩδΣΫτͰ͋Ε͹ଈ ઓྗΛظ଴Ͱ͖Δ(ࣄ͕ଟ͍) • Ϩʔϧ͔Β֎Ε·ͬͯͨ͘৔߹͸ผ͕ͩ
  56. ஍ਤ͕ͳ͍෦෼ʹ௚໘ͨ͠Β • ͱ͸͍͑ɺ஍ਤͷͳ͍஍Ҭ΋ଟ͍ • ͦͷձࣾಛ༗ͷΧϧνϟʔ • ฐࣾͩͬͨΒσʔλετΞܥͷ֓೦͕ଟ͘ ଘࡏ͢Δ • ஍ਤΛ࣋ͨͳ͍ਓ:

    ͲΜͳ஍ਤ͕͍Δͷ͔ͷΤ εΧϨ • ஍ਤΛ࣋ͭਓ: ஍ਤΛ޿͘஌Β͠ΊΔ౒ྗ
  57. ·ͣ͸ॻ͍ͯΈΔ

  58. ϨϏϡʔΛґཔ

  59. ౰ͨΓલͩ͠஍ຯ͚ͩͲɺ͢ ͘͝େࣄ !

  60. ࣼʹߏ͍͑ͯͯ͝ΊΜͳ͍͞ !

  61. ·ͱΊ • ٕज़తෛ࠴ɿωΨςΟϒͳΠϝʔδ • ͍ΘΏΔٕज़తෛ࠴ʹΑΔѱӨڹ • ࠓͦͷ࣌ɺखΛՃ͑Α͏ͱ͢Δࣗ෼ׂ͕৯ ͍ͬͯΔͨΊ • ࣗ෼ࣗ਎͸ίϯτϩʔϧՄೳ(Ͱ͢ΑͶʁ)

    • ίϯτϩʔϧෆೳͳͷ͸ ະདྷͱଞਓ
  62. ·ͱΊ • ະདྷͷෆ࣮֬ੑ΁ͷରॲ͸ఘΊͨʹͯ͠΋ɺଞ ਓͱͷෆ࣮֬ੑͳΒݮΒͤΔ͔΋ • νʔϜ಺Ͱ஍ਤΛڞ༗͠Α͏ • ྑ͖νʔϜ։ൃΛʂ • ະདྷ͕ݟ͑ͳ͍ʁͦΕͳΒ……

  63. We are hiring!! • ΞϐʔϧϙΠϯτ • େن໛σʔλ / B to

    B ͳΒͰ͸ͷݻ͞ • َͷΑ͏ʹίʔυ͕ॻ͚Δ • ఆ࣌ͷ֓೦͕ͳ͍ • ෰૷ࣗ༝ʗϦϞʔτϫʔΫࣗ༝ • Conferenceνέοτ୅͕ग़Δ
  64. એ఻ɿRepro Tech Meetup https://repro-tech.connpass.com/event/94282/

  65. Happy Hacking!!

  66. ࢀߟ: શମΞʔΩςΫνϟڞ༗