Lock in $30 Savings on PRO—Offer Ends Soon! ⏳

Protocol Buffersのスキーマを利用した開発

sonatard
August 31, 2019

Protocol Buffersのスキーマを利用した開発

sonatard

August 31, 2019
Tweet

More Decks by sonatard

Other Decks in Programming

Transcript

  1. ͦͳଠ @sonatard D Technologies • ωοτϫʔΫɺLinuxαʔόΠϯϑϥ 4೥ • RTOS, Socket,

    TCP/IP, DHCP, DNS࣮૷ 7೥ • GAE/Go 2.5೥ • TypeScript, React 5ϲ݄ • iOS, Swift 2೔ • ΞʔΩςΫνϟɺઃܭ • MVCܥ • Clean Architecture • ϦϑΝΫλϦϯά • OOP, SOLIDݪଇ • ৽͍͠ύϥμΠϜΛษڧͯ͠ɺγεςϜ΍ ίʔυΛγϯϓϧʹ͢Δ͜ͱ͕޷͖ • ࠷ۙͷϒʔϜ͸GraphQLͱRx(Swift)
  2. • ͸ ͡ Ί ʹ • . p r o

    t o ϑ Ν Π ϧ ͷ ύ ʔ ε ͱ ར ༻ • Ԡ ༻ ฤ • p r o t o ϑ Ν Π ϧ Λ ύ ʔ ε ͠ ͯ ͍ Δ π ʔ ϧ • · ͱ Ί
  3. 4 ͸͡Ίʹ w ۙ೥(31$ͷීٴͱͱ΋ʹ1SPUPDPM#V⒎FST΋ଟ͘ͷػձͰར༻͞ΕΔ Α͏ʹͳΓ·ͨ͠ɻ w 1SPUPDPM#V⒎FST͸(31$Ͱར༻͞ΕΔγϦΞϥΠθʔγϣϯπʔϧͱ ͯ͠ར༻Ͱ͖Δ͜ͱͱͱ΋ʹɺεΩʔϚͱͯ͠ͷར༻Ձ஋΋ߴ͘༗༻ Ͱ͢ɻ w

    ࢲͱͯ͠͸+40/4DIFNF΍0QFO"1*ʹൺ΂ͯɺͱͯ΋ಡΈ΍͍͢ ϑΥʔϚοτͩͱࢥ͍·͢ w ·ͨύʔε͔ͯ͠Βͷपล։ൃ؀ڥ΋੔͍ͬͯΔͨΊɺεΩʔϚΛ ύʔεͯࣗ͠෼ͨͪͷͨΊͷπʔϧΛ։ൃ͢Δ͜ͱͰɺ೔ৗͷ։ൃۀ ຿Λվળ͢Δ͜ͱ͕ͱͯ΋͠΍͍͢Ͱ͢
  4. 6 1SPUPDPM#V⒎FSTͱ͸ w 1SPUPDPM#V⒎FST͸ɺߏ଄ԽσʔλΛγϦΞϥΠζ͢ΔͨΊͷॊೈͰ ޮ཰తͳࣗಈԽϝΧχζϜɻ w ߏ଄Խσʔλ w *OUFSGBDF%FpOJUJPOMBOHVBHF *%-

    ʹΑΓఆٛ͢Δɻ w γϦΞϥΠζ w ެࣜͰఏڙ͞Ε͍ͯΔπʔϧɺ*%-Ͱఆٛͨͨ͠͠σʔλߏ଄͔ Βίʔυੜ੒Λߦ͏ɻ w ੜ੒͞ΕͨίʔυΛݩʹެࣜϥΠϒϥϦΛ༻͍ͯγϦΞϥΠζɺ σγϦΞϥΠζ͢Δɻ w ༷ʑͳݴޠʹରԠ͍ͯ͠Δ w $ $ %BSU (P +BWB 1ZUIPO
  5. 9 ओͳར༻ྫ w (31$ w QSPUPDŠHP@PVUQMVHJOTHSQDQSPUPVTFSQSPUP w ੜ੒͞ΕΔίʔυ w ࣮૷͢Δίʔυ

    w ੜ੒͞ΕͨΠϯλʔϑΣʔεʹ͋Θ࣮ͤͯ૷Λ༻ҙ͢Δͱɺ SFRVFTUͷγϦΞϥΠζΛࣗಈͰͨ͠ޙɺ࣮૷ͨ͠ϝιουΛ࣮ߦ ͯ͘͠ΕΔ
  6. 11 1SPUPDPM#V⒎FSTͷޡղ w (31$ͱҰॹʹ࢖Θͳ͚Ε͹͍͚ͳ͍ w ❌ w 1SPUPDPM#V⒎FST͸ɺ(31$͔Βಠཱͨ͠࢓༷ͱπʔϧͰ͋Δ w ⭕

    w ʮεΩʔϚఆٛ͸͍͚ͨ͠Ͳ)551ͱҟͳΔͱ͜Ζ͕͋ΔͷͰ(31$ ͷ࠾༻͕೉͍͠ʯ w ❌ w εΩʔϚఆٛΛͯ͠ɺ)551ͷ#PEZʹ1SPUPDPM#V⒎FSTΛ৐ͤͯૹΔ ͜ͱ͕Ͱ͖Δ w ߋʹεΩʔϚͱͯ͠͸QSPUPϑΝΠϧΛ࢖͍ɺ)551ͷ#PEZʹ+40/Λ ৐ͤͯૹΔ͜ͱ΋Ͱ͖Δ w ͭ·Γ+40/εΩʔϚͷ୅ସͱͯ͠࢖͏͜ͱ΋Մೳ
  7. 13 )551Ͱͷ1SPUPDPM#V⒎FSTͷར༻+40/ΛૹΔ w ઌ΄ͲͷQSPUPͱ΄΅ಉ౳ʹ+40/΋γϦΞϥΠζͰ͖Δ w +40/ͱͯ͠γϦΞϥΠζ͢Δίʔυ w ௨ৗͷKTPOύοέʔδͰ͸ͳ͘ɺKTPOQCύοέʔδΛར༻͢Δ w +40/ͱ1SPUPDPM#V⒎FSTͷ૬ޓม׵͸࢓༷ͱͯ͠ఆΊΒΕ͍ͯΔͨ

    Ίɺͦͷ࢓༷ʹଇ࣮ͬͨ૷ͱͳ͍ͬͯΔ w IUUQTEFWFMPQFSTHPPHMFDPNQSPUPDPMCV⒎FSTEPDT QSPUPKTPO ࣮૷ͨ͠ϝιουΛ࣮ߦ KTPOQCͰσγϦΞϥΠζ KTPOQCͰγϦΞϥΠζͯ͠ૹ৴
  8. 15 (31$ͱಉ༷ʹ)551 +40/PSQSPUP ϓϥάΠϯΛ࡞Ε͹ྑ͍ ωοτϫʔΫ )551Ͱૹ৴͞ΕͨσʔλΛ ߏ଄ମʹϚοϐϯά ؔ਺࣮ߦ ΫϥΠΞϯτ ։ൃऀ͸௨৴ϓϩτίϧʹґଘͨ͠

    ίʔυΛॻ͔ͳ͍ͰࡁΉ QSPUPDͷ IUUQϓϥάΠϯ QSPUPϑΝΠϧ εΩʔϚ αʔό ։ൃ؀ڥ ಡΈࠐΈ σϓϩΠ $POUFOU5ZQFʹΑͬͯ QSPUPͱKTPO੾Γସ͑ΔͳͲ΋Մೳ
  9. • ͸ ͡ Ί ʹ • . p r o

    t o ϑ Ν Π ϧ ͷ ύ ʔ ε ͱ ར ༻ • Ԡ ༻ ฤ • p r o t o ϑ Ν Π ϧ Λ ύ ʔ ε ͠ ͯ ͍ Δ π ʔ ϧ • · ͱ Ί
  10. 30 QSPUPDΛར༻ͯ͠ύʔεͯ͠ಠࣗͷπʔϧΛ࡞੒͢Δ w ͱͷҧ͍͸ϓϥάΠϯͱ࣮ͯ͠૷͠ͳ͍ͱ͍͏͜ͱͰ͢ w ͪ͜ΒͩͱQMVHJOʹൺ΂࣮ͯ૷͕୯७Ͱ͢ w ·ͨಠࣗͷίϚϯυϥΠϯπʔϧͱͯ͠࡞੒ՄೳͰ͢ w QCQBSTFS1BSTF'JMF͕ߦͳ͍ͬͯΔ͜ͱ͸ɺQSPUPDίϚϯυΛ࣮ߦ͠

    ͯඪ४ग़ྗʹύʔεͨ݁͠ՌΛग़ྗͯ͠ɺQMVHJOͱಉ͡ܗࣜͷܕʹ VONBSTIBM͍ͯ͠·͢ w QSPUPDŠEFTDSJQUPS@TFU@PVUEFWTUEPVUͰඪ४ग़ྗͰ͖Δ w QCQBSTFS͸ɺHJUIVCʹஔ͍͓͖ͯ·ͨ͠ w IUUQTHJUIVCDPNTPOBUBSEQCQBSTFS
  11. • ͸ ͡ Ί ʹ • . p r o

    t o ϑ Ν Π ϧ ͷ ύ ʔ ε ͱ ར ༻ • Ԡ ༻ ฤ • p r o t o ϑ Ν Π ϧ Λ ύ ʔ ε ͠ ͯ ͍ Δ π ʔ ϧ • · ͱ Ί
  12. 44 Ԡ༻ฤ w QSPUPͷύʔεΛ͔ͯͦ͜͠Β)551ΫϥΠΞϯτΛੜ੒͠·͕ͨ͠ɺ ࣮͸QSPUP͔Β)551ͷม׵ʹ͸࢓༷͕ࡦఆ͞Ε͓ͯΓɺઌ΄Ͳͷ࣮૷ ͸ͦͷ࢓༷ʹଇ͍ͬͯΔΘ͚Ͱ͸͋Γ·ͤΜɻ w ࣾ಺πʔϧͰಛఆ༻్ʹ࢖͏ͷʹ͸े෼Ͱ͕͢ɺ֎෦πʔϧͱ͠ ͯެ։͢ΔͳΒۃྗ࢓༷ʹै͏΂͖Ͱ͢ w

    HPPHMFBQJ)UUQ3VMF w (31$ͱ)551ϝιουͷม׵͸ɺ(PPHMF͕نఆ͍ͯ͠Δ w ͜Ε͸༗໊ͳHSQDHBUFXBZͰ΋ར༻͍ͯ͠Δ࢓༷ w IUUQTDMPVEHPPHMFDPNFOEQPJOUTEPDTHSQDTFSWJDFDPOpH SFGFSFODFSQDHPPHMFBQJIUUQSVMF w ͜ͷ࢓༷ʹਖ਼֬ʹै͏ͱ޻਺͕େ෯ʹ૿Ճ͠·͢
  13. 46 Ԡ༻ฤHPPHMFBQJ)UUQ3VMF w HPPHMFBQJ)UUQ3VMF͸ɺ1SPUPDPM#V⒎FSTͷPQUJPOͱ͍͏࢓༷ʹجͮ ͖ఆٛ͞Ε͍ͯ·͢ɻ w ͜ͷPQUJPOͷ࢓༷΋QSPUPϑΝΠϧͰఆٛ͞Ε͓ͯΓɺͦͷQSPUP͔Β ੜ੒͞ΕͨίʔυΛར༻͢Δ͜ͱͰύʔε͕ՄೳʹͳΓ·͢ɻ w ఆٛ͞ΕͨQSPUPϑΝΠϧ͸ҎԼʹଘࡏ͠·͢

    w IUUQTHJUIVCDPNHPPHMFBQJTHPPHMFBQJTCMPCNBTUFS HPPHMFBQJBOOPUBUJPOTQSPUP w QSPUPϑΝΠϧ͔Βੜ੒͞Εͨ(Pͷιʔείʔυ͸ҎԼʹଘࡏ͠·͢ w IUUQHPPHMFHPMBOHPSHHFOQSPUPHPPHMFBQJTBQJBOOPUBUJPOT
  14. 52 Ԡ༻ฤHPPHMFBQJ)UUQ3VMF w ޻਺͕େ෯ʹ૿͑Δͱݴ͏ׂʹࢥͬͨΑΓେมͰ͸ͳ͔ͬͨ  w )UUQ3VMFͷ࢓༷͸͜Ε͚ͩͰ͸ͳ͍ w ͜ΜͳPQUJPO΋ॻ͚ͯ͠·͏ʜ w

    ະରԠͳ࢓༷͸υΩϡϝϯτʹهࡌ͠·͠ΐ͏ ͭͷ31$ʹෳ਺ͷ)551ϦΫΤετ CPEZͷํΛϦΫΤετͷ ಛఆͷϑΟʔϧυʹ௚઀Ϛοϐϯά ͦͷଞʹ΋ύεύϥϝʔλɺ ΫΤϦʔετϦϯάͳͲ
  15. 54 Ԡ༻ฤ w QSPUP͔Β1PTUNBOͷKTPOͷϦΫΤετύϥϝʔλΛੜ੒͢Δ w ؆୯ʹͰ͖ͦ͏ͰɺͰ͖ͳ͍ύλʔϯ w ՝୊ w (Pͷ$SFBUF6TFS3FRVTUߏ଄ମ͕͋Ε͹ɺ+40/͸ੜ੒Ͱ͖Δ

    w ύʔεͨ࣌͠఺Ͱ͸(Pͷߏ଄ମͱͯ͠$SFBUF6TFS3FRVFTU͸ੜ੒ ͞Ε͍ͯͳ͍ɻී௨͸ҎԼͷϑϩʔ͕ඞཁʹͳΔ w ύʔεɺ(PͷϑΝΠϧग़ྗɺग़ྗͨ͠ϑΝΠϧͷϏϧυ͢Δ w ͭ·Γύʔεͨ͠ஈ֊Ͱ͸ɺ+40/Λ࡞Δ͜ͱ͸೉͍͠
  16. • ͸ ͡ Ί ʹ • . p r o

    t o ϑ Ν Π ϧ ͷ ύ ʔ ε ͱ ར ༻ • Ԡ ༻ ฤ • p r o t o ϑ Ν Π ϧ Λ ύ ʔ ε ͠ ͯ ͍ Δ π ʔ ϧ • · ͱ Ί
  17. 59 1SPUPDPM#V⒎FSTΛύʔε͍ͯ͠Δπʔϧ঺հ w HSQDHBUFXBZIUUQTHJUIVCDPNHSQDFDPTZTUFNHSQDHBUFXBZCZZVHVJ͞Μ w HPPHMFBQJ)UUQ3VMFΛ࢓༷௨Γʹύʔε͢Δؾ֓͋Δํ͸ࢀߟʹͳΔ w FWBOTIUUQTHJUIVCDPNLUSFWBOTCZLUS͞Μ w (31$DMJFOU

    w $-*Ϟʔυͱ3&1-Ϟʔυ͕͋Δɺ3&1-ϞʔυͰ͸ಈతʹิ׬͕ޮ͘ w KIVNQQSPUPSFqFDUΛ࠾༻ w QSPUPDHFOHPIUUQIUUQTHJUIVCDPNOBNFUBLFQSPUPDHFOHPIUUQCZOBNFUBLF ͞Μ w (31$ͱಉ͡ίʔυࣗಈੜ੒Λ)551Ͱ΋࣮ݱ͢ΔQSPUPDϓϥάΠϯ w $POUFOU5ZQFʹ͋Θͤͯ+40/PS1SPUP͔൑ఆͯ͠σγϦΞϥΠζ͢Δ w IUUQTHJUIVCDPNQTFVEPNVUPQSPUPLJUΛ࠾༻ w QSPUPUPQPTUNBOIUUQTHJUIVCDPNTPOBUBSEQSPUPUPQPTUNBOCZTPOBUBSE w QSPUP͔ΒQPTUNBOͷઃఆΛɺJNQPSUՄೳͳKTPOܗࣜͰग़ྗ͢Δ w KIVNQQSPUPSFqFDUΛ࠾༻
  18. • ͸ ͡ Ί ʹ • . p r o

    t o ϑ Ν Π ϧ ͷ ύ ʔ ε ͱ ར ༻ • Ԡ ༻ ฤ • p r o t o ϑ Ν Π ϧ Λ ύ ʔ ε ͠ ͯ ͍ Δ π ʔ ϧ • · ͱ Ί