リファクタリングチャンスを探せ
by
Kaoru Hotate
Link
Embed
Share
Beginning
This slide
Copy link URL
Copy link URL
Copy iframe embed code
Copy iframe embed code
Copy javascript embed code
Copy javascript embed code
Share
Tweet
Share
Tweet
Slide 1
Slide 1 text
ϦϑΝΫλϦϯάνϟϯεΛ୳ͤʂ ,BPSV)PUBUF!QVSVOLBPSV $SBTTJ3BJMT/JHIU DMBTTJ@SBJMT@OJHIU 1
Slide 2
Slide 2 text
อཱ֜ ,BPSV)PUBUF 5XJUUFS!QVSVOLBPSV ϝυϐΞͱ͍͏ձࣾͷ ΤϯδχΞͰ͢ 3VCZྺ͘Β͍ ΤϯδχΞྺ ࣗݾհ 2
Slide 3
Slide 3 text
ࠓϦϑΝΫλϦϯάͷΛ͠·͢ʂ 3
Slide 4
Slide 4 text
ϦϑΝΫλϦϯάͷͷલʹɾɾɾ ࠷ۙͷΈࣄʢআʣΛ͠·͢ 4
Slide 5
Slide 5 text
5
Slide 6
Slide 6 text
‣ झຯɾޘָͷਓ͍Δ ͷͨΊʹΔਓ͍Δ Β͞ΕͯΔਓ͍Δ ݟͯݟ͵ৼΓΛ͢Δਓ͍Δ ‣ ϦϑΝΫλϦϯά Γ͍ͨਓɾզຫͰ͖ͳ͍ਓ͕Δʁ ‣ ༷ʑͳਓ͕͍ΔதͰɺϦϑΝΫλϦϯάΛ ৫ϨϕϧͰߦ͏ͷ͔ͳΓͦ͠͏ ϦϑΝΫλϦϯάҰॹʁ 6
Slide 7
Slide 7 text
‣ ࠓɺϦϑΝΫλϦϯάΛ৫Ͱߦ͏ࡍͷ ಈػ͚ͱࢦʹযΛͯͯ͠·͢ ‣ ʮͳͥʯʮͲ͏ͬͯʯͰͳ͘ɺ ʮԿΛʯϦϑΝΫλϦϯά͢Δ͔ʹ͍ͭͯ͠·͢ ‣ ࣮ફ͍ͯ͠Δํ࠶֬ೝͰ͖ΔʹͳΕͱࢥ͍·͢ ࠓͷ͓ͳ͠ 7
Slide 8
Slide 8 text
1BSU ΤϯδχΞνʔϜͰͷ ϦϑΝΫλϦϯάͷϞνϕʔγϣϯΛ্͛Δ 8
Slide 9
Slide 9 text
ϦϑΝΫλϦϯάΛΔཧ༝ͷେ෦ɺҎԼͷͭͰ͢ ‣ ʮ໘നͦ͏ʂʯ ྑ͍ઃܭΛҙࣝ͢ΔͷͰɺʹͭͳ͕Δ ‣ ʮզຫͰ͖ͳ͍ʂʯ ྑ͘ͳ͍ίʔυΛ໓ͯ͠ɺਫ਼ਆతॆײΛಘΔ ଞͷਓʹݟΒΕͨ͘ͳ͍ίʔυΛͬͦ͜Γྑ͓ͯ͘͘͠ ϦϑΝΫλϦϯά͕తʹͳΓ͕ͪɾɾɾ ϦϑΝΫλϦϯάΛ͕Δཧ༝ 9
Slide 10
Slide 10 text
ϦϑΝΫλϦϯά͚ͩͷ࣌ؒΛͱΔ͜ͱͰ ʮྑ͍ઃܭʯΛҙࣝͯ͠ίʔυΛॻ͘Α͏ʹͳΔ ϦϑΝΫλϦϯάʹͭͳ͕Δ 10 ϦϑΝΫλϦϯά͕ಘҙʹͳΔͱɺʢதུʣѱ͍ίʔυΛॻ͘ͷΛΊɺ ѱ͍׳शʹै͏ͷΛΊɺϓϨϑΝΫλϦϯάΛ࢝ΊΔͷͩɻʢதུʣ ίʔυͷϦϑΝΫλϦϯάɺίʔυΛॻ͘ͱ͖ʹ͍͚ͯ͠ͳ͍͜ͱɺ ΘΓʹ͖͢͜ͱΛֶͿ্Ͱ࠷ͷํ๏ͷͭͳͷͩɻ %BWJE4DPUU#FSOTUFJOஶʮϨΨγʔίʔυ͔Βͷ٫ʯΑΓ
Slide 11
Slide 11 text
ྑ͍ઃܭΛ࣮ײ͢ΔΈ͕ඞཁ 11 ‣ ڠྗ͠߹͏ ‣ ϖΞϓϩɾϞϒϓϩ ‣ ٕज़ސ ‣ ϧʔϧʹଇΔ ‣ 40-*%ݪଇ ‣ ˓˓ύλʔϯ
Slide 12
Slide 12 text
‣ 'BU.PEFMͷղফύλʔϯΛ ͭͷࣄྫʹ͚ͯհ͍ͯ͠·͢ IUUQTTQFBLFSEFDLDPNIPUBUFLBPSVGBUNPEFMOJEVJDIVTVSVUVGBMTFSJIVBLVUBSJOHVQBUBO 'BU.PEFMͷղফύλʔϯ 12
Slide 13
Slide 13 text
‣ ϦϑΝΫλϦϯάظతʹ͓ۚΛੜΈग़ͮ͠Β͍ͷ ‣ Γͨͯ͘ඇΤϯδχΞ͔Βཧղ͕ಘΒΕͳ͍ ݁ՌΕ͍ͯͳ͍ਓ͕ଟ͍ͷͰʁ ࣮ࡍɾɾɾ 13
Slide 14
Slide 14 text
1BSU ඇΤϯδχΞʹ ϦϑΝΫλϦϯάΛཧղͯ͠Β͏ 14
Slide 15
Slide 15 text
͚ͩ͜͜ͷͰ͕͢ɺ ؆୯ͳํ๏Λݟ͚ͭ·ͨ͠ 15
Slide 16
Slide 16 text
ΠϯύΫτͷ͋ΔʮΒ͔͠ʯΛ͢Ε0, ˞औΓ·ͤΜ 16
Slide 17
Slide 17 text
‣ ϦϑΝΫλϦϯάͱ͍͏ɺ ظతʹपΓʹධՁ͞ΕͮΒ͍ ཧղΛಘͮΒ͍ ‣ ධՁɾཧղΛಘΔͨΊʹɺࣈ͕ඞཁ ‣ ඇΤϯδχΞͷཧղΛಘΔͨΊʹ ఆྔతʹՌΛग़ͤΔՕॴ͔Β ϦϑΝΫλϦϯά͠·͠ΐ͏ ϦϑΝΫλϦϯάͷՌΛ໌֬ʹ͠Α͏ 17
Slide 18
Slide 18 text
‣ ϨεϙϯελΠϜ ‣ ςετͷ࣮ߦ ‣ ίʔυͷ࣭ ‣ $PEF$MJNJBUF ‣ SVCZDSJUJD ‣ ίʔυͷՄಡੑ ‣ $POUSPMMFSͷߦ ‣ 3VCPDPQͷEJTBCMF ϦϑΝΫλϦϯάͷఆྔతͳՌ 18
Slide 19
Slide 19 text
‣ /FX3FMJD4LZMJHIUͰ ϨεϙϯελΠϜ͕͍ॲཧΛௐࠪ ‣ मਖ਼ྫ ‣ /Λແ͘͢ ‣ ൃߦ͞ΕΔΫΤϦΛνϡʔχϯά͢Δ ‣ ඇಉظʹͰ͖Δॲཧඇಉظʹ͢Δ ‣ ͍ॲཧΛݺͼग़͢ճΛݮΒ͢ ‣ SFEJTNFNDBDIFE ϦϑΝΫλϦϯάͷ,1*ྫʢϨεϙϯελΠϜʣ 19
Slide 20
Slide 20 text
‣ ѹతʹ͍ͷɺKTUSVFͳ&&ͷςετ ‣ KTଆͷϩδοΫΛKFTUͳͲͷKTςετʹدͤΔ ‣ $POUSPMMFSͷϩδοΫΛ.PEFMଆʹدͤΔ ‣ ͨ·ʹམͪΔςετͷআ ϦϑΝΫλϦϯάͷ,1*ྫʢςετͷ࣮ߦʣ 20
Slide 21
Slide 21 text
‣ ෳՕॴͷڞ௨ϩδοΫʢίϐϖʣΛݮΒ͢ ‣ ෳࡶͳ࣮ΛݮΒ͢ मਖ਼ྫ ‣ $PEF$MJNBUFͷධՁΛ্͛Δ ‣ SVCZDSJUJDͷධՁΛ্͛Δ ϦϑΝΫλϦϯάͷ,1*ྫʢίʔυͷ࣭ΛߴΊΔʣ 21
Slide 22
Slide 22 text
https://codeclimate.com/ ‣ Φʔϓϯιʔεແྉ ‣ ؒͷτϥΠΞϧظؒ͋Γ ͦͷ͋ͱ༗ྉ ‣ ࣌ؒʹ༨༟͕͋Εը໘ݟͤΔ $PEF$MJNBUF 22
Slide 23
Slide 23 text
https://github.com/whitesmith/rubycritic ‣ ࣌ؒʹ༨༟͕͋Εը໘ݟͤΔ SVCZDSJUJD 23
Slide 24
Slide 24 text
‣ ʮඞཁʹഭΒΕΔલʹʯՄಡੑΛߴΊΔमਖ਼Λߦ͏ ‣ ඇΤϯδχΞͷཧղඞཁ मਖ਼ྫ ‣ $POUSPMMFSͷߦΛݮΒ͢ ‣ 3VCPDPQͷEJTBCMFΛݮΒ͢ ‣ .PEFMͷॲཧΛผΫϥεʹҕৡ͢Δ ϦϑΝΫλϦϯάͷ,1*ྫʢՄಡੑΛߴΊΔʣ 24
Slide 25
Slide 25 text
‣ ϦϑΝΫλϦϯάΤϯδχΞͱͯ͠ͷʹͭͳ͕Δ ‣ ΤϯδχΞ͕ࣗൃతʹϦϑΝΫλϦϯά͢ΔͨΊʹɺ Λ࣮ײͰ͖ΔΈ͕ඞཁ ‣ ඇΤϯδχΞʹϦϑΝΫλϦϯάΛ ཧղͯ͠Β͏ͨΊʹɺ ͰՌΛใࠂͰ͖ΔϦϑΝΫλϦϯά͕ඞཁ ·ͱΊ 25
Slide 26
Slide 26 text
ࢀߟจݙ 26 ‣ ϨΨγʔίʔυ͔Βͷ٫ ʕιϑτΣΞͷण໋ΛԆ͠ ՁΛߴΊΔͭͷϓϥΫςΟε %BWJE4DPUU#FSOTUFJOஶ
Slide 27
Slide 27 text
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ 27