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

Form Object へ捧げる気持ち

75badb20b126821f3acd4ec40848e32c?s=47 HaiTo
September 06, 2018

Form Object へ捧げる気持ち

75badb20b126821f3acd4ec40848e32c?s=128

HaiTo

September 06, 2018
Tweet

Transcript

  1. FormObjectʹ๋͛Δؾ࣋ͪ HaiTo / දࢀಓrb#38

  2. ໨࣍ • About me • Conclusion • Context, Subject •

    Why • Conclusion - Revival
  3. ໨࣍ • About me • Conclusion • Context, Subject •

    Why • Conclusion - Revival
  4. HaiTo Name: HaiTo Hobby: Game(League of Legends) ࠷ۙ͸PHPॻ͍ͯ·͢ɻ දࢀಓ.rbٱʑ͗͢Δ

  5. ͖͑͘͢Ύʔͣ • ڧ͍ݴ༿Λൃ੠͠·͢ɻ • Θ͟ͱἤΓؾຯʹൃ੠͠·͢ɻ • ຊ౰͸ʮνʔϜͰٞ࿦ͯ͠ྑ͍ͱࢥͬͨͦͷ࣌఺ͷίϯ ηϯαεʹଇͬͯιϑτ΢ΣΞॻ͍͍ͯ͜͏ͳʯͱৗʹ ࢥ͍ͬͯ·͕͢ɺҰ୴͜ͷ͜ͱ͸๨Εͯ࿩͠·͢ɻ

  6. ໨࣍ • About me • Conclusion • Context, Subject •

    Why • Conclusion - Revival
  7. େ੾ͳ͜ͱ͸࠷ॳʹ

  8. Զ͕ѱ͔ͬͨɻૉ௚ʹؒҧ͍ΛೝΊΔ͔Βɺ ΋͏FormObjectͱ͔࡞Δͷ͸΍Ίͯ͘Ε ݩωλ: https://qiita.com/joker1007/items/25de535cd8bb2857a6

  9. ໨࣍ • About me • Conclusion • Context, Subject •

    Why • Conclusion - Revival
  10. Context • ݹࠓ౦੢ɺRailsͷMVCɺಛʹModelͷऔѻʹ͍ͭͯਓʑ͸಄Λ๊ ͖͑ͯͨ • ServiceClass, FormObject, Decorator, … •

    ModelΛऔΓѻ͏ผͷ૚Λ௥Ճ͢Δ͜ͱͰɺڽू౓ΛߴΊΔɺ͋Δ ͍͸ςελϏϦςΟΛߴΊΔ • ͦΜͳࢥ࿭ͷதͰ͜Ε·Ͱͨ͘͞ΜͷϨΠϠʔ΍࢓૊Έ͕Railsͷ ্ʹߏங͞Ε͍ͯͬͨ • Form Objectɺ൴΋·ͨͦͷ͏ͪͷҰਓͩ
  11. Subject • FormObject ͱ͍͏໊લͰɺViewModel͕ര஀͢Δ • ͜Ε͸ྑͦ͞͏ • ͦͯͦ͠ͷViewModel͕ͳ͔ͥӬଓԽͷ஌ࣝΛ͍࣋ͬͯ Δ •

    ŠƀŜƄƂŜŽūŘ
  12. ໨࣍ • About me • Conclusion • Context, Subject •

    Why, What • Conclusion - Revival
  13. ͲΏ͜ͱ͔ʁ • Sublime Text 3 ʹFormObjectͷαϯϓϧίʔυ͕͋Δ ͷͰݟΔ • αϯϓϧίʔυͷ save

    ͸؆ศ͔ͩΒ͍͍͚Ͳɺ͍ͩͨ ͍FormObject͕ര஀͢Δͱ͖͸ෳࡶͳۀ຿༻݅ͱARͰ ఆٛ͞ΕͨσʔλεΩʔϚͷϛεϚονʹΑͬͯര஀͠ ͨΓɺContextΛ໌ࣔ͢ΔͨΊʹര஀͢ΔͷͰɺͦͷ Contextʹ͓͚ΔಛผͳValidation΍Save࣌ͷσʔλͷந ग़ɺ੔ܗ͕ൃੜͨ͠Γ·͢ɻ
  14. None
  15. ͲΏ͜ͱ͔ʁ • αϯϓϧίʔυͷ save ͸؆ศ͔ͩΒ͍͍͚Ͳɺ͍ͩͨ ͍FormObject͕ര஀͢Δͱ͖͸ෳࡶͳۀ຿༻݅ͱARͰ ఆٛ͞ΕͨσʔλεΩʔϚͷϛεϚονʹΑͬͯര஀͠ ͨΓɺContextΛ໌ࣔ͢ΔͨΊʹര஀͢ΔͷͰɺͦͷ Contextʹ͓͚ΔಛผͳValidation΍Save࣌ͷσʔλͷந ग़ɺ੔ܗ͕ൃੜͨ͠Γ·͢ɻ

  16. ͲΏ͜ͱ͔ʁ • ͋ͱɺ͔ͤͬ͘ARͷੈք؍͔Β཭ΕͨͷʹΘ͟Θ͟ෳ਺ ͷ੹຿Λ࣋ͬͨClassΛ࡞Δͷ΋͍͔͕ͳ΋ͷ͔ʁ • ViewModelɺͭ·Γෳ਺ͷϞσϧ΍͋ΔϞσϧ͔Βಛఆ ίϯςΫετʹଇͬͨଐੑΛ࣋ͬͨදࣔ޲͚ͷObject ͡Όͳ͍Ͱ͔͢ • ͳΜͰͦͷViewModel͕ӬଓԽͷ஌ࣝΛ࣋ͬͯΔΜͰ͢

    ͔ʂ AR͡Ό͋Δ·͍ʹʂAR͡Ό͋͋Δ·͍ʹʂʂʂ
  17. Ͱɺ͓લ͸Ͳ͏͍ͨ͠ͷʁ • Sublime Text 3ͷαϯϓϧίʔυ࠶ͼ

  18. None
  19. Ͱɺ͓લ͸Ͳ͏͍ͨ͠ͷʁ • ݸਓతʹ͸͜Ε͘Βཻ͍౓খ͍ͨ͘͞͠ • ͋Δ͍͸FormObject͕ࣗ਎Λ౉ͯ͠SignupClassΛୟ͘ ͱ͔ɻ͘͢ͳ͘ͱ΋ผClassɻ

  20. ໨࣍ • About me • Conclusion • Context, Subject •

    Why • Conclusion - Revival
  21. OOPͱ͔FormObjectΛ͢Ε͹͍͍ͱ͔ͦ͏ ͍͏ͷࣙΊͯɺͱΓ͋͑ͣ΄Μͱ੹຿ʹԠ͡ ͯΨϯΨϯClass࡞͍ͬͯ͜͏