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

コードの自動修正によって実現する、機能開発を止めないフレームワーク移行

gree_tech
November 11, 2021

 コードの自動修正によって実現する、機能開発を止めないフレームワーク移行

GREE Tech Conference 2021 で発表された資料です。
https://techcon.gree.jp/2021/session/Session-2

gree_tech

November 11, 2021
Tweet

More Decks by gree_tech

Other Decks in Technology

Transcript

  1. ໦ଜ༸ଠ ˔ॴଐ ˓ άϦʔϥΠϑελΠϧגࣜձࣾ ϓϩμΫτ։ൃ෦ ϝσΟΞ։ൃ άϧʔϓ ΤϯδχΞϦϯάνʔϜ ˔ܦྺ ˓

    ೥ άϦʔϥΠϑελΠϧגࣜձࣾ ೖࣾ ˓ ओʹʮ-*.*"ʯͷαʔόʔɾΠϯϑϥ։ൃ ࣗݾ঺հ 2 2
  2. ˔Ҡߦલ ˓ ϑϨʔϜϫʔΫ ˙ 'VFM1)1 ˓ ݴޠ ˙ 1)1 ˓

    Πϯϑϥ ˙ &$ ˔Ҡߦޙ ˓ ϑϨʔϜϫʔΫ ˙ -BSBWFM ˓ ݴޠ ˙ 1)1 ˓ Πϯϑϥ ˙ &$4'BSHBUF 5 ϑϨʔϜϫʔΫҠߦϓϩδΣΫτ https://aws.amazon.com/jp/architecture/icons/
  3. 7 ͳͥࣗಈमਖ਼ʹ౿Έ੾͔ͬͨʁ ˔ܰྔͳ'VFM1)1ػೳͷଟ͍-BSBWFM΁ͷҠߦ ˓ %# 2VFSZ#VJMEFS $POUSPMMFS͋ͨΓΛஔ͖׵͑Ε͹ྑͦ͞͏ ˓ 7JFXपΓ͸ςϯϓϨʔτΤϯδϯΛஔ͖׵͑Δ͚ͩͰྑͦ͞͏ ˔खಈमਖ਼ͷݫ͠͞

    ˓ ສߦ௒͑ͷίʔυϕʔε ˓ ਓ΍͕࣌ؒ଍Γͳ͍ ˓ ػೳ։ൃΛฒߦͰߦ͍͍͕ͨʜʜ ˙ ҠߦݩͱҠߦޙͷίʔυͷ྆ํΛมߋ͢Δඞཁ͕͋Δ ˙ ҠߦޙͷίʔυʹมߋΛՃ͑ΔͱDPOGMJDU͕ى͜ΓಘΔ ˙ ػೳ։ൃΛࢭΊΔ͔͠ͳ͍͕ɺࢭΊͨ৔߹͸൒೥ۙ͘ػೳ։ൃ͕ਐ·ͳ͍͜ͱ ͕ݟࠐ·Εͨ
  4. 8 3FDUPS SFDUPSQIQSFDUPS ˔ࣗಈϦϑΝΫλϦϯάɾϚΠάϨʔγϣϯπʔϧ ˓ %FBE$PEF &BSMZ3FUVSOͳͲͷϦϑΝΫλϦϯάϧʔϧ ˓ 1)1όʔδϣϯͷVQHSBEF EPXOHSBEF

    ˔ಛ௃ ˓ OJLJDQIQBTU Λϕʔεʹந৅ߏจ໦ʢ"45ʣΛฤू ˓ ܕ৘ใΛ1)14UBO͔ΒऔಘͰ͖Δ ˓ ςετ͕ॻ͖΍͍͢ ˓ ։ൃ͕׆ൃ
  5. 9 ϑϨʔϜϫʔΫҠߦʹ͓͚Δίʔυͷमਖ਼ྫ ˔2VFSZ#VJMEFSͷஔ͖׵͑ ˓ XIFSF DPM JO C XIFSF*O B

    C ˓ XIFSF DPM  TVC2VFSZ XIFSF4VC DPM TVC2VFSZ ˓ %#TFMFDU@BSSBZ <JE OBNF> %#TFMFDU JE OBNF ˔$POUSPMMFSͷஔ͖׵͑ ˓ *OQVU 3FRVFTU 3FTQPOTFͳͲΛରԠ͢Δϝιουʹஔ͖׵͑ ˓ $POUSPMMFSΛQTS४ڌʹSFOBNF ˓ QTSͷOBNFTQBDFʹ߹ΘͤͨσΟϨΫτϦ΁Ҡಈ
  6. 10 3FDUPSͷม׵ྫ&BSMZ3FUVSO $IBOHF/FTUFE*GT5P&BSMZ3FUVSO3FDUPS public function hoge($value) { if ($value %

    2 === 0) { if ($value % 3 === 0) { return 'yes'; } } return 'no'; } public function hoge($value) if ($value % 2 !== 0) { return 'no'; } if ($value % 3 === 0) { return yes; } return 'no'; }
  7. 11 ந৅ߏจ໦ "CTUSBDU4ZOUBY5SFF"45 https://github.com/nikic/PHP-Parser <?php $var = "Hello World!"; Stmt_Expression

    expr Expression_Assign var, expr Expression_Variable name: var Scalar_String value: Hello World! expr var expr
  8. 12 3FDUPSͷॲཧʢந৅ߏจ໦ͷฤूʣ public function getNodeTypes(): array { return [String_::class]; }

    public function refactor($node): ?Node { if ($node->value === "Hello World!") { $node->value = "Hello GREE Tech Conf!"; return $node; } return null; } Scalar_String value: Hello GREE Tech Conf! Stmt_Expression expr Expression_Assign var, expr Expression_Variable name: var expr var Scalar_String value: Hello World! Scalar_String value: Hello World!
  9. 13 3FDUPSͷॲཧʢந৅ߏจ໦͔Βίʔυͷߏஙʣ Scalar_String value: Hello GREE Tech Conf! <?php $var

    = "Hello GREE Tech Conf!"; Stmt_Expression expr Expression_Assign var, expr Expression_Variable name: var expr var
  10. 19 ͳͥࣗಈमਖ਼ʹ౿Έ੾͔ͬͨʁʢ࠶ܝʣ ˔ܰྔͳ'VFM1)1ػೳͷଟ͍-BSBWFM΁ͷҠߦ ˓ %# 2VFSZ#VJMEFS $POUSPMMFS͋ͨΓΛஔ͖׵͑Ε͹ྑͦ͞͏ ˓ 7JFXपΓ͸ςϯϓϨʔτΤϯδϯΛஔ͖׵͑Δ͚ͩͰྑͦ͞͏ ˔खಈमਖ਼ͷݫ͠͞

    ˓ ສߦ௒͑ͷίʔυϕʔε ˓ ਓ΍͕࣌ؒ଍Γͳ͍ ˓ ػೳ։ൃΛฒߦͰߦ͍͍͕ͨʜʜ ˙ ҠߦݩͱҠߦޙͷίʔυͷ྆ํΛมߋ͢Δඞཁ͕͋Δ ˙ ҠߦޙͷίʔυʹมߋΛՃ͑ΔͱDPOGMJDU͕ى͜ΓಘΔ ˙ ػೳ։ൃΛࢭΊΔ͔͠ͳ͍͕ɺࢭΊͨ৔߹͸൒೥ۙ͘ػೳ։ൃ͕ਐ·ͳ͍͜ͱ ͕ݟࠐ·Εͨ
  11. 20 ίʔυͷࣗಈमਖ਼ʹΑΔػೳ։ൃͱҠߦͷฒߦ։ൃ ։ൃϒϥϯν ˓ ػೳ։ൃɺόάमਖ਼ ˓ 1)1ʹ൐͏ίʔυमਖ਼ Ҡߦ༻ϒϥϯν ˓ 3FDUPSͷϧʔϧͷ࡞੒

    ˓ -BSBWFMؔ࿈ϑΝΠϧͷ௥Ճ ࠓ·Ͱ௨ΓͷϑϩʔͰ 2"ɾϦϦʔε $*ʹΑΔ ࣗಈमਖ਼ Ҡߦ؀ڥͰͷςετ ΞϓϦέʔγϣϯͷίʔυ͸ Ҡߦ༻ϒϥϯνͰ͸ฤू͠ͳ͍
  12. 22 ίʔυͷࣗಈमਖ਼Λ΍Δ্Ͱʜʜ ˔ςετ ˓ ͋Δͱͱͯ΋ྑ͍ ˓ -*.*"Ͱ͸ςετ͸͋·Γಈ͍͍ͯͳ͔ͬͨ ˔3FDUPSϧʔϧͷςετ ˓ ϧʔϧʹΑΔม׵Λ͋Δఔ౓อূͰ͖Δ

    ˓ 3FDUPS͸CSFBLJOHDIBOHF͕ଟ͍ͷͰ݁ߏ໾ʹཱͬͨ ˔੩తղੳπʔϧ ˓ 1)14UBOͷಋೖ ˙ Ұ൪໾ʹͨͬͨ ˙ ػೳ։ൃͷํͷόά΋ݕग़ͯ͘͠Εͨ
  13. 24 ࣗಈमਖ਼ʹΑΔҠߦ·ͱΊ ˔ྑ͔ͬͨ͜ͱ ˓ ෺ྔʹର߅Ͱ͖Δ ˓ ώϡʔϚϯΤϥʔΛݮΒͤΔ ˓ ৽ن௥Ճ͞ΕͨϑΝΠϧ΋ࣗಈͰҠߦ͞ΕΔ ˓

    ػೳ։ൃͱDPOqJDU͢Δ͜ͱ͕ͳ͍ ˔ѱ͔ͬͨ͜ͱ ˓ -BSBWFMͷػೳΛϑϧʹ࢖͑ͳ͍ ˓ ந৅ߏจ໦ͷਂ͍஌ࣝͳͲ͕ඞཁͰଐਓԽ͠΍͍͢
  14. 25 ҠߦϓϩδΣΫτΛऴ͑ͯ ˔ࣗಈमਖ਼Λܾஅͯ͠ྑ͔ͬͨ ˔3FDUPSͱ͍͏πʔϧʹग़ձ͑ͯྑ͔ͬͨ ˓ 1)11)1Ͱ΋׆༂ͦ͠͏ʂ ˓ ϦϑΝΫλϦϯάπʔϧͱͯ͠$*ʹೖΕ͍ͨ ˔ΠϯϑϥͷҠߦ΋ָ͔ͬͨ͠ ˓

    71$5SBGGJD.JSSPSJOHʹΑΔෛՙςετ ˓ &$ͱ'BSHBUFͰͷΧφϦϠϦϦʔεΛߦ͏ͨΊͷ޻෉ ˓ $*$%΋େ෯ʹվળ ˓ ΤϯδχΞϒϩάॻ͖͍ͨͱࢥ͍ͬͯ·͢ʜʜ
  15. 26