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

1400万ユーザーのWebサービスを 15年運用して考える、
Javaである理由

1400万ユーザーのWebサービスを 15年運用して考える、
Javaである理由

masaozi3

May 18, 2019
Tweet

More Decks by masaozi3

Other Decks in Technology

Transcript

  1. ϑϦϡʔגࣜձࣾླ໦ਅੜ !NBTBP[Jʣ
    ສϢʔβʔͷ8FCαʔϏεΛ
    ೥ӡ༻ͯ͠ߟ͑Δɺ

    +BWBͰ͋Δཧ༝

    View full-size slide

  2. w ϑϦϡʔגࣜձࣾ!ژ౎
    w ࣾձਓྺ΋+BWBྺ΋೥໨
    w +BWBͱ4QSJOHͰz(*3-4Λ)"11:ʹz͢Δ࢓ࣄΛ͍ͯ͠·͢
    w େֶ࣌୅͸1ZUIPOͰ8FCΞϓϦΛ։ൃ
    ޷͖ͳ΋ͷ
    ษڧձͷελοϑɺϊϕϧςΟͷൃ஫ɺ͓͍͍͓͠ञ

    ϔΞΧϥʔϒϦʔνɺ୐഑ͷ഑ૹঢ়گΛோΊΔ
    ླ໦ਅੜ !NBTBP[J

    !2
    ʘ·͓͞Ͱ͢ʗ
    w w w

    View full-size slide

  3. w ࠓ೔ͷΰʔϧ
    w ࿩ͷ͖͔͚ͬ
    w ฐࣾͷαʔϏεͱٕज़બ୒ͷ࿩
    w ೔ʑͷӡ༻͔ΒΈΔ+BWBͰ͋Δཧ༝
    w ʲ͓·͚ʳ+%,ͷҠߦͷ࿩
    w ݁࿦
    w ͓͠Βͤ
    ࠓ೔࿩͢͜ͱ
    !3
    ੩͔ʙʹฉ͘ΑΓ΋

    ΘʔΘʔݴ͍ͳ͕Β

    ฉ͍ͯ΋Β͑Ε͹خ͍͠Ͱ͢ʂ

    View full-size slide

  4. w ࠓ೔ͷΰʔϧ
    w ࿩ͷ͖͔͚ͬ
    w ฐࣾͷαʔϏεͱٕज़બ୒ͷ࿩
    w ೔ʑͷӡ༻͔ΒΈΔ+BWBͰ͋Δཧ༝
    w ʲ͓·͚ʳ+%,ͷҠߦͷ࿩
    w ݁࿦
    w ͓͠Βͤ
    ࠓ೔࿩͢͜ͱ
    !4
    ʮ೥ӡ༻ͯ͠ʯͱ͍͍ͭͭ

    ೥ϲ݄͔͠ݟͯͳ͍ͷͰ

    ௐ΂ͨ৘ใ΋͋Γ·͢

    View full-size slide

  5. ࠓ೔ͷΰʔϧ

    View full-size slide

  6. !6
    ʮ+BWB͕దͨ͠αʔϏεͱ͸Կ͔ʯ
    ΁ͷҰͭͷղΛݟ͚ͭΔ͜ͱ

    View full-size slide

  7. ࿩ͷ͖͔͚ͬ

    View full-size slide

  8. w 4DBMB͕େ޷͖ͳઌഐ͕+BWBΛॻ͍͍ͯͯ೔ʑۤͦ͠͏Ͱ͋Δ
    w पғͷ༑ਓ͕ʮ+BWB͸ઈରॻ͖ͨ͘ͳ͍ʯͳͲݴ͍ͬͯͯɺ

    ͳΜ͔ͩ൵͍͠
    w ͱ͸͍͑ࣗ෼΋+BWB͕͘͢͝޷͖ͱ͍͏Θ͚Ͱ͸ͳ͍
    w ྡͷνʔϜ͸αʔόʔαΠυ,PUMJOΛݕ౼͍ͯ͠ΔΑ͏ͩʁ
    w ผͷݴޠΛݕ౼ͨ͜͠ͱ͸͋ΔΒ͍͠ɹɹɹɹɹͳͲͳͲ
    ࿩ͷ͖͔͚ͬ
    !8

    View full-size slide

  9. w 4DBMB͕େ޷͖ͳઌഐ͕೔ʑۤͦ͠͏Ͱ͋Δ
    w पғͷ༑ਓ͕ʮ+BWB͸ઈରॻ͖ͨ͘ͳ͍ʯͳͲݴ͍ͬͯͯɺͳΜ͔ͩ൵
    ͍͠
    w ͱ͸͍͑ࣗ෼΋+BWB͕͘͢͝޷͖ͱ͍͏Θ͚Ͱ͸ͳ͍
    w ྡͷνʔϜ͸αʔόαΠυ,PUMJOΛݕ౼͍ͯ͠ΔΑ͏ͩʁ
    w ผͷݴޠΛݕ౼ͨ͜͠ͱ͸͋ΔΒ͍͠
    ࿩ͷ͖͔͚ͬ
    !9
    ͳΜͰ+BWBΛ࢖͍ͬͯΔΜͩΖ͏ʁ
    +BWB͕ద͍ͯ͠Δ΋ͷͬͯͳΜͩΖ͏ʁ
    ഑ଐ͞ΕͨϓϩμΫτ͕+BWB͔ͩͬͨΒ

    Ҏ֎ͷཧ༝͸ͳ͍ͷͩΖ͏͔ʁ

    View full-size slide

  10. w 4DBMB͕େ޷͖ͳઌഐ͕೔ʑۤͦ͠͏Ͱ͋Δ
    w पғͷ༑ਓ͕ʮ+BWB͸ઈରॻ͖ͨ͘ͳ͍ʯͳͲݴ͍ͬͯͯɺͳΜ͔ͩ൵
    ͍͠
    w ͱ͸͍͑ࣗ෼΋+BWB͕͘͢͝޷͖ͱ͍͏Θ͚Ͱ͸ͳ͍
    w ྡͷνʔϜ͸αʔόαΠυ,PUMJOΛݕ౼͍ͯ͠ΔΑ͏ͩʁ
    w ผͷݴޠΛݕ౼ͨ͜͠ͱ͸͋ΔΒ͍͠
    ࿩ͷ͖͔͚ͬ
    !10
    ⾠ܾͯ͠ϚαΧϦΛ౤͛ʹདྷͨͷͰ͸ͳ͍Ͱ͢
    ʮ࢖͏͔Βʹ͸ɺྑ͞Λ஌Γ͍ͨʯ
    Έͳ͞Μͷ+BWBΛબΜͩཧ༝΍

    +BWBͷ޷͖ͳͱ͜ΖͳͲ΋ͥͻฉ͖͍ͨͰ͢

    View full-size slide

  11. ฐࣾͷαʔϏεͱ

    ٕज़બ୒ͷ࿩

    View full-size slide

  12. w ϓϦըऔಘαʔϏε

    ϓϦϯτγʔϧػͰࡱӨͨ͠ը૾Λ

    εϚϗ΍Ψϥέʔʹμ΢ϯϩʔυ͢Δ
    w ϓϦըΛ࢖ͬͨ4/4
    w Խহ඼ͷϓϨθϯτ
    w ϓϦᝑମͷޱίϛ
    ฐࣾͷαʔϏεϐΫτϦϯΫ
    !12

    View full-size slide

  13. w தֶੜʙେֶੜͷ(*3-4͕λʔήοτ

    ˞(*3-4ʜࣗ෼Λ(*3-4ͱೝ͍ࣝͯ͠Δ͢΂ͯͷਓ

    w ձһ਺ສਓҎ্
    w ଔۀࣜɺϋϩ΢ΟϯɺΫϦεϚεͳͲʹ

    ΞΫηε͕૿͑Δ
    ฐࣾͷαʔϏεϐΫτϦϯΫ
    !13

    View full-size slide

  14. w ೥Ψϥέʔ޲͚αΠτΛϦϦʔε

    αʔόʔͷ࣮૷͸+BWB
    w ೥εϚϗ޲͚αΠτωΠςΟϒΞϓϦΛϦϦʔε

    αΠτΞϓϦͷαʔόʔ͸ͱ΋ʹ+BWB

    "OESPJEΞϓϦ΋+BWB
    w ೥ݱࡏʜ

    ਓͰӡ༻։ൃத
    ฐࣾͷαʔϏεϐΫτϦϯΫ
    !14

    View full-size slide

  15. w ೥Ψϥέʔ޲͚αΠτΛϦϦʔε

    αʔόʔͷ࣮૷͸+BWB
    w ೥εϚϗ޲͚αΠτωΠςΟϒΞϓϦΛϦϦʔε

    αΠτΞϓϦͷαʔόʔ͸ͱ΋ʹ+BWB

    "OESPJEΞϓϦ΋+BWB
    w ೥ݱࡏʜ

    ਓͰӡ༻։ൃத
    ฐࣾͷαʔϏεϐΫτϦϯΫ
    !15

    ࠓ΋มΘΒͣ+BWB+BWB͍ͯ͠Δʂ

    View full-size slide

  16. ٕज़બ୒ͷ࿩+BWB
    !16
    Ψϥέʔ޲͚αʔϏε͕+BWBͰ͋ͬͨཧ༝
    ஌ݟ͕ઌબ୒ࢶͷগͳ͞

    View full-size slide

  17. w ʙ೥ࠒ+BWB͕ग़࢝Ίͨ࣌୅

    ιϑτ΢ΣΞ։ൃݚڀͷΑ͏ͳͱ͜Ζ

    +BWBͰԿ͔ࣄۀ͕Ͱ͖ͳ͍͔ͱ໛ࡧ
    ٕज़બ୒ͷ࿩
    !17
    Ψϥέʔ޲͚αʔϏε͕+BWBͰ͋ͬͨཧ༝
    +BWBͰ

    Կ͔ʜ

    View full-size slide

  18. ٕज़બ୒ͷ࿩
    !18
    Ψϥέʔ޲͚αʔϏε͕+BWBͰ͋ͬͨཧ༝
    w ʙ೥ࠒ+BWB͕ग़࢝Ίͨ࣌୅

    +BWBͰԿ͔ࣄۀ͕Ͱ͖ͳ͍͔ͱ໛ࡧ
    w ௨৴ܥϛυϧ΢ΣΞ͕׬੒

    View full-size slide

  19. ٕज़બ୒ͷ࿩
    !19
    Ψϥέʔ޲͚αʔϏε͕+BWBͰ͋ͬͨཧ༝
    Τϯλϝ

    ͍ͨ͠ͳ
    w ΤϯλʔςΠϯϝϯτܥͷ͜ͱ΋͍ͨ͠ʂ

    ϓϦػͱΨϥέʔͷ௨৴ͱ͔Ͳ͏ͩΖ͏͔

    View full-size slide

  20. ٕज़બ୒ͷ࿩
    !20
    Ψϥέʔ޲͚αʔϏε͕+BWBͰ͋ͬͨཧ༝
    w ΤϯλʔςΠϯϝϯτܥͷ͜ͱ΋͍ͨ͠ʂ
    w ଞͷݴޠ΋ݕ౼ͯ͠Έͨˠબ୒ࢶ͕গͳ͍
    w "QBDIF5PNDBUͰͭ͘ΔΑ͏ͳ΋ͷ
    1FSM
    "QBDIF
    "QBDIF

    5PNDBU
    +BWB

    View full-size slide

  21. ٕज़બ୒ͷ࿩
    !21
    Ψϥέʔ޲͚αʔϏε͕+BWBͰ͋ͬͨཧ༝
    w ΤϯλʔςΠϯϝϯτܥͷ͜ͱ΋͍ͨ͠ʂ
    w ଞͷݴޠ΋ݕ౼ͯ͠Έͨˠબ୒ࢶ͕গͳ͍
    w "QBDIF5PNDBUͰͭ͘ΔΑ͏ͳ΋ͷ
    w ࣾ಺ʹ+BWBͷ஌ݟ͕ཷ·͍ͬͯΔͳʜ
    1FSM
    "QBDIF
    "QBDIF

    5PNDBU
    +BWB

    View full-size slide

  22. ٕज़બ୒ͷ࿩
    !22
    Ψϥέʔ޲͚αʔϏε͕+BWBͰ͋ͬͨཧ༝
    w ΤϯλʔςΠϯϝϯτܥͷ͜ͱ΋͍ͨ͠ʂ
    w ଞͷݴޠ΋ݕ౼ͯ͠Έͨˠબ୒ࢶ͕গͳ͍
    w "QBDIF5PNDBUͰͭ͘ΔΑ͏ͳ΋ͷ
    w ࣾ಺ʹ+BWBͷ஌ݟ͕ཷ·͍ͬͯΔͳʜ
    +BWB
    ஌ݟ͕ઌબ୒ࢶͷগͳ͞Ͱ+BWBʹ

    View full-size slide

  23. ٕज़બ୒ͷ࿩
    !23
    ҆ఆͱલ਎αʔϏεɺ+7.
    εϚϗ޲͚αʔϏε͕+BWBʹͳͬͨཧ༝

    View full-size slide

  24. w ʙ೥ͷϦϦʔεʹ޲͚ٕͯज़ݕ౼Λ͢Δ

    +BWBʹݶΒͣଞͷݴޠ΍ϑϨʔϜϫʔΫ΋ݕ౼
    w ֶशίετ͕Ͳͷ͘Β͍ͳͷ͔
    w ϑϨʔϜϫʔΫͷ҆ఆ౓߹͍ɹɹͳͲͳͲ
    ٕज़બ୒ͷ࿩
    !24
    εϚϗ޲͚αʔϏε͕+BWBʹͳͬͨཧ༝
    4
    1MBZ
    +BWB
    ʜ
    1)1
    4DBMB

    View full-size slide

  25. w ʙ೥ͷϦϦʔεʹ޲͚ٕͯज़ݕ౼Λ͢Δ

    +BWBʹݶΒͣଞͷݴޠ΍ϑϨʔϜϫʔΫ΋ݕ౼
    w ࣾ಺ࢿ࢈͸׆༻͍ͨ͠ͷͰ+7.ݴޠ͕ྑ͍

    Ψϥέʔ޲͚αʔϏεͰ։ൃͨ͠ϥΠϒϥϦͳͲ
    ٕज़બ୒ͷ࿩
    !25
    εϚϗ޲͚αʔϏε͕+BWBʹͳͬͨཧ༝
    4
    1MBZ
    +BWB
    ʜ
    1)1
    4DBMB

    View full-size slide

  26. w ʙ೥ͷϦϦʔεʹ޲͚ٕͯज़ݕ౼Λ͢Δ

    +BWBʹݶΒͣଞͷݴޠ΍ϑϨʔϜϫʔΫ΋ݕ౼
    w ࣾ಺ࢿ࢈͸׆༻͍ͨ͠ͷͰ+7.ݴޠ͕ྑ͍

    Ψϥέʔ޲͚αʔϏεͰ։ൃͨ͠ϥΠϒϥϦͳͲ
    w 1MBZͱ4DBMBͷ૊Έ߹Θ͕ͤ҆ఆ͍ͯ͠ͳ͍࣌ظ
    ٕज़બ୒ͷ࿩
    !26
    εϚϗ޲͚αʔϏε͕+BWBʹͳͬͨཧ༝
    4
    1MBZ
    +BWB
    ʜ
    1)1
    4DBMB

    View full-size slide

  27. w ʙ೥ͷϦϦʔεʹ޲͚ٕͯज़ݕ౼Λ͢Δ

    +BWBʹݶΒͣଞͷݴޠ΍ϑϨʔϜϫʔΫ΋ݕ౼
    w ࣾ಺ࢿ࢈͸׆༻͍ͨ͠ͷͰ+7.ݴޠ͕ྑ͍

    Ψϥέʔ޲͚αʔϏεͰ։ൃͨ͠ϥΠϒϥϦͳͲ
    w 1MBZͱ4DBMBͷ૊Έ߹Θ͕ͤ҆ఆ͍ͯ͠ͳ͍࣌ظ
    ٕज़બ୒ͷ࿩
    !27
    εϚϗ޲͚αʔϏε͕+BWBʹͳͬͨཧ༝
    4
    1MBZ
    +BWB
    ʜ
    1)1
    4DBMB
    ҆ఆͱલ਎αʔϏεɺ+7.Ͱ+BWBʹ

    View full-size slide

  28. w ೥Ψϥέʔ޲͚αΠτΛϦϦʔε

    ஌ݟ͕ઌબ୒ࢶͷগͳ͔͞Β+BWBʹ
    w ೥εϚϗ޲͚αΠτωΠςΟϒΞϓϦΛϦϦʔε

    ҆ఆͱલ਎αʔϏεɺ+7.͔Β+BWBʹ
    ٕज़બ୒ͷ࿩·ͱΊ
    !28
    ݴޠ࢓༷Ͱ͸ͳ͍෦෼͕ओͳཧ༝

    View full-size slide

  29. ೔ʑͷӡ༻͔ΒΈΔ

    +BWBͰ͋Δཧ༝

    View full-size slide

  30. !30
    ݴޠͷϢʔβʔ͕ଟ͍
    ੩తܕ෇͚ίϯύΠϥ͕ڧྗͰ͋Δ
    ྫ֎Λ໌֬ʹॲཧͰ͖Δ

    View full-size slide

  31. !31
    ݴޠͷϢʔβʔ͕ଟ͍
    ੩తܕ෇͚ίϯύΠϥ͕ڧྗͰ͋Δ
    ྫ֎Λ໌֬ʹॲཧͰ͖Δ

    View full-size slide

  32. Ϣʔβʔ਺ͷগͳ͍ݴޠ΍ϑϨʔϜϫʔΫΛ࢖͍ͬͯͨࠒ
    w ࣅͨ͜ͱΛ͍ͯ͠Δਓ͕ډͳ͍
    w ຊ΋هࣄ΋͋Μ·Γͳ͍
    ࠔ͔ͬͯΒղܾ·Ͱ͕ԕ͔ͬͨ
    ݴޠͷϢʔβʔ͕ଟ͍
    !32
    ͍ͬͺ͍ͭΒ͍

    View full-size slide

  33. Ͱ΋+BWBͳΒ
    w ࣅͨ͜ͱΛ͍ͯ͠Δਓ͕୔ࢁډΔ
    w ຊ΋هࣄ΋୔ࢁ͋Δ
    ࠔͬͯ΋ௐ΂Ε͹ॿ͔Δ཰͕ߴ͍
    ٯʹ৘ใʹຒ΋Εͯ͠·͏͜ͱ΋͋Δ
    ݴޠͷϢʔβʔ͕ଟ͍
    !33
    ͭΒ͘ͳ͍ʂ

    View full-size slide

  34. ϝϯςφϯε͞Ε͍ͯΔ΋ͷ͕ଟ͘ɺ࢖͍ଓ͚ΒΕΔ҆৺͕͋Δ
    w ϥΠϒϥϦɺϑϨʔϜϫʔΫͳͲ
    w ࢖͏ਓ͕ډΔ͠ɺίϛοτ͢Δਓ͕͍Δ
    େن໛ͳαʔϏεͱͯ͠͸҆৺ͯ͠࢖͑Δ͜ͱ͕خ͍͠
    ⾠ར༻͢Δ͚ͩͰͳ͘ίϛοτ͍͖ͯ͠·͠ΐ͏ͱ͍͏࿩
    ݴޠͷϢʔβʔ͕ଟ͍
    !34

    View full-size slide

  35. ࣾ಺֎໰ΘͣਓతϦιʔε͕५୔Ͱ͋Δ
    w ଞ෦ॺͱਓΛߦ͖དྷͰ͖Δ
    w શ͘ҟͳΔ੡඼Λ࡞Δ෦ॺͱٕज़ަྲྀ͕Ͱ͖Δ

    ᝒମͷ૊ΈࠐΈιϑτ΢ΣΞͷνʔϜͳͲ
    w ࣾ֎Ͱ΋ਓΛݟ͚ͭ΍͍͢
    w ++6($$$ͱ͔΋ָ͍͋ͬͯ͠☺

    ݴޠͷϢʔβʔ͕ଟ͍
    !35

    View full-size slide

  36. !36
    ݴޠͷϢʔβʔ͕ଟ͍
    ੩తܕ෇͚ίϯύΠϥ͕ڧྗͰ͋Δ
    ྫ֎Λ໌֬ʹॲཧͰ͖Δ

    View full-size slide

  37. +BWB͸੩తܕ෇͚ݴޠ

    ɹɹɹίϯύΠϧ࣌ʹܕνΣοΫΛͯ͘͠ΕΔ
    ྫ͑͹
    ੩తܕ෇͚ͰίϯύΠϥ͕ڧྗ
    !37

    View full-size slide

  38. ϥΠϒϥϦଆͰ
    ੩తܕ෇͚ͰίϯύΠϥ͕ڧྗ
    !38

    public interface VegetableService {
    /**
    * ݱࡏͷ०ͷ໺ࡊΛฦ͢
    * @return
    */
    Vegetable getInSeason(List vegetables);
    }

    View full-size slide

  39. ར༻ଆͰ
    ੩తܕ෇͚ͰίϯύΠϥ͕ڧྗ
    !39

    public class KithenController {
    @Resource
    VegetableService vegetableService;
    @RequestMapping(path = "/recommend")
    public ModelAndView recommendMenu() {
    List vegetables = refrigeratorService.findVegetables();
    Vegetable vegetable = vegetableService.getInSeason(vegetables);
    //ฦ͖ͬͯͨ໺ࡊͰ͓͢͢ΊͷݙཱΛߟ͑Δ…
    return new ModelAndView("/reccomend.html");
    }
    }

    View full-size slide

  40. ར༻ଆͰ
    ੩తܕ෇͚ͰίϯύΠϥ͕ڧྗ
    !40

    public class KithenController {
    @Resource
    VegetableService vegetableService;
    @RequestMapping(path = "/recommend")
    public ModelAndView recommendMenu() {
    List vegetables = refrigeratorService.findVegetables();
    Vegetable vegetable = vegetableService.getInSeason(vegetables);
    //ฦ͖ͬͯͨ໺ࡊͰ͓͢͢ΊͷݙཱΛߟ͑Δ…
    return new ModelAndView("/reccomend.html");
    }
    }
    ०ͷ໺ࡊͬͯ

    Ұݸ͡Όͳ͍Αͳ

    View full-size slide

  41. ϥΠϒϥϦଆͰ
    ੩తܕ෇͚ͰίϯύΠϥ͕ڧྗ
    !41

    public interface VegetableService {
    /**
    * ݱࡏͷ०ͷ໺ࡊΛฦ͢
    * @return
    */
    List getInSeason(List vegetables);
    }

    View full-size slide

  42. ར༻ଆͰ
    ੩తܕ෇͚ͰίϯύΠϥ͕ڧྗ
    !42

    public class KithenController {
    @Resource
    VegetableService vegetableService;
    @RequestMapping(path = "/recommend")
    public ModelAndView recommendMenu() {
    List stockVegetables = refrigeratorService.findVegetables();
    List vegetables = vegetableService.getInSeason(stockVegetables);
    //ฦ͖ͬͯͨ໺ࡊͰ͓͢͢ΊͷݙཱΛߟ͑Δ…
    return new ModelAndView("/reccomend.html");
    }
    }

    View full-size slide

  43. ར༻ଆͰ
    ੩తܕ෇͚ͰίϯύΠϥ͕ڧྗ
    !43

    public class KithenController {
    @Resource
    VegetableService vegetableService;
    @RequestMapping(path = "/recommend")
    public ModelAndView recommendMenu() {
    List stockVegetables = refrigeratorService.findVegetables();
    List vegetables = vegetableService.getInSeason(stockVegetables);
    //ฦ͖ͬͯͨ໺ࡊͰ͓͢͢ΊͷݙཱΛߟ͑Δ…
    return new ModelAndView("/reccomend.html");
    }
    }

    ίϯύΠϧ

    Τϥʔ

    View full-size slide

  44. ಉ͘͡ར༻ଆͰ
    ੩తܕ෇͚ͰίϯύΠϥ͕ڧྗ
    !44
    public class ShoppingController {
    @Resource
    VegetableService vegetableService;
    @RequestMapping(path = "/market")
    public ModelAndView market() {
    List vegetables = specialPriceService.findVegetables();
    Vegetable vegetable = vegetableService.getInSeason(vegetables);
    //ฦ͖ͬͯͨ०ͷ໺ࡊΛͲ΍͜΍…
    return new ModelAndView("/market.html");
    }
    }
    ͸Θʔ͍͢·ͤΜ

    ͦͬͪ΋࢖ͬͯͨ

    View full-size slide

  45. ʮ͍΍͍΍ͦΕ͸ͳ͍ʯʮͦΜͳ͠ΐͬͺ͍ϛεʜʯ

    ʮͦ΋ͦ΋ͦΜͳमਖ਼ͷ࢓ํʜʯ

    ͱࢥ͍·͕͢
    w ٸ͍Ͱमਖ਼͍ͯ͠Δͱ͖
    w σʔλΞΫηε૚ʙϓϨθϯςʔγϣϯ૚·ͰҰؾʹ͔͍͍ͯΔͱ͖
    w ϥΠϒϥϦ΋·ͱΊͯॻ͍ͯΔͱ͖
    ͳͲɺҊ֎΍ͬͯ͠·͏ɻ
    ੩తܕ෇͚ͰίϯύΠϥ͕ڧྗ
    !45

    View full-size slide

  46. ʜઌఔͷίʔυΛϦϦʔε͔ͯ͠Βϲ݄ޙʜ
    ੩తܕ෇͚ͰίϯύΠϥ͕ڧྗ
    !46

    View full-size slide

  47. ϥΠϒϥϦଆͰ
    ੩తܕ෇͚ͰίϯύΠϥ͕ڧྗ
    !47

    public interface VegetableService {
    /**
    * ݱࡏͷ०ͷ໺ࡊΛฦ͢
    * @return
    */
    List getInSeason(List vegetables);
    }

    View full-size slide

  48. ϥΠϒϥϦଆͰ
    ੩తܕ෇͚ͰίϯύΠϥ͕ڧྗ
    !48

    public interface VegetableService {
    /**
    * ݱࡏͷ०ͷ໺ࡊΛฦ͢
    * @return
    */
    List getInSeason(List vegetables) throws NoVegetablesException;
    }
    ۭͳΒ

    ྫ֎ʹͨ͘͠

    ͳ͖ͬͯͨ

    View full-size slide

  49. ར༻ଆͰ
    ੩తܕ෇͚ͰίϯύΠϥ͕ڧྗ
    !49

    List vegetables = vegetableService.getInSeason(stockVegetables);

    try {
    List vegetables = vegetableService.getInSeason(stockVegetables);
    } catch (NoVegetablesException e) {
    e.printStackTrace();
    }
    ,JUDIFO$POUSPMMFSͱ
    4IPQQJOH$POUSPMMFSͰ

    ࢖͚ͬͯͨͬͳʙ

    View full-size slide

  50. ར༻ଆͰ
    ੩తܕ෇͚ͰίϯύΠϥ͕ڧྗ
    !50

    List vegetables = vegetableService.getInSeason(stockVegetables);

    try {
    List vegetables = vegetableService.getInSeason(stockVegetables);
    } catch (NoVegetablesException e) {
    e.printStackTrace();
    }

    ίϯύΠϧ

    Τϥʔ

    View full-size slide

  51. ػೳ௥Ճ͞Ε͍ͯͨʂ
    ੩తܕ෇͚ͰίϯύΠϥ͕ڧྗ
    !51
    public class FlyerController {
    @Resource
    VegetableService vegetableService;
    @RequestMapping(path = "/available")
    public ModelAndView availableFlyerView() {
    List vegetables = specialPriceService.findVegetables();
    Vegetable vegetable = vegetableService.getInSeason(vegetables);
    //ฦ͖ͬͯͨ०ͷ໺ࡊΛͲ΍͜΍…
    return new ModelAndView(“/available.html");
    }
    }
    Θʔ͓

    ͦͬͪ΋࢖ͬͯͨ

    View full-size slide

  52. ͪ͜Β΋ʮͦΜͳ͜ͱ͋Δʁʯͱࢥ͏͔΋͠Ε·ͤΜ͕
    w େ͖ͳ࣮૷ ϲ݄Ҏ্͔͔ΔͳͲ
    Λ͍ͯ͠Δͱ͖
    w ಉ͡ϓϩμΫτʹରͯͦ͠Μͳ࣮૷͕ฒߦͰ૸Δঢ়گͷͱ͖
    ͳͲ΍͸Γ΍ͬͯ͠·͏৔໘͕͋Δɻ
    ੩తܕ෇͚ͰίϯύΠϥ͕ڧྗ
    !52

    View full-size slide

  53. ੩తܕ෇͚ͰίϯύΠϥ͕ڧྗ
    !53
    ࡉ͔͍ϛε͸ಈ͔͢લʹؾ͚ͮΔ΄͏͕

    Ұͭͣͭண࣮ʹ࣮૷ΛਐΊΒΕΔͷͰ

    ॻ͖͸͡Ί͔Β׬ྃ·Ͱ͕ૣ͍
    ͱ͸͍͑*%&͕ݡ͘ར༻ՕॴΛ୳ͤͨΓ͢ΔͷͰ

    ίϯύΠϥΛ௨ͣ͞ͱ΋ؾ͚ͮΔͱ΋͍͏

    View full-size slide

  54. !54
    ݴޠͷϢʔβʔ͕ଟ͍
    ੩తܕ෇͚ίϯύΠϥ͕ڧྗͰ͋Δ
    ྫ֎Λ໌֬ʹॲཧͰ͖Δ

    View full-size slide

  55. Ϣʔβʔ͕ສਓ͍Δͱʮكͳҟৗܥʯׂ͕ͱΑ͘ൃੜ͢Δ
    ྫ֎Λ໌֬ʹॲཧͰ͖Δ
    !55
    //΄΅ى͜Γ͑ͳ͍͕…
    if(hoge.isEmpty()) {
    return new Collections.emptyList();
    }

    View full-size slide

  56. Ϣʔβʔ͕ສਓ͍Δͱʮكͳҟৗܥʯׂ͕ͱΑ͘ൃੜ͢Δ
    w ࣮૷࣌఺Ͱ͸ຊ౰ʹك͕ͩͬͨଞͷػೳ௥ՃͰى͖΍͘͢ͳͬͨ
    w ϦϦʔε͔ͯ͠Β݁ߏك͡Όͳ͍ͳͱൃ֮ɹͳͲͳͲ
    ྫ֎Λ໌֬ʹॲཧͰ͖Δ
    !56

    View full-size slide

  57. Ϣʔβʔ͕ສਓ͍Δͱʮكͳҟৗܥʯׂ͕ͱΑ͘ൃੜ͢Δ
    ྫ֎Λ໌֬ʹॲཧͰ͖Δ
    !57
    //΄΅ى͜Γ͑ͳ͍͕…
    if(hoge.isEmpty()) {
    return new Collections.emptyList();
    }
    ى͜ΔΜ͔ʜ

    View full-size slide

  58. Ϣʔβʔ͕ສਓ͍Δͱʮكͳҟৗܥʯׂ͕ͱΑ͘ൃੜ͢Δ

    ͜͏͍͏ಛघέʔεʹରͯ͠ɺ

    ࣗ෼͕ͨͪѻ͍΍͍͢ྫ֎Λఆٛͯ͠ॲཧΛଅͤΔͷ͸ར఺
    ྫ֎Λ໌֬ʹॲཧͰ͖Δ
    !58
    //΄΅ى͜Γ͑ͳ͍͕…
    if(hoge.isEmpty()) {
    return throw new HogeIsEmptyException();
    }
    ྫ֎ʹͨͬͨ͠
    ΄͏͕͍ͳ

    View full-size slide

  59. !59
    ݴޠͷϢʔβʔ͕ଟ͍
    ੩తܕ෇͚ίϯύΠϥ͕ڧྗͰ͋Δ
    ྫ֎Λ໌֬ʹॲཧͰ͖Δ

    View full-size slide

  60. !60
    ݴޠͷϢʔβʔ͕ଟ͍
    ੩తܕ෇͚ίϯύΠϥ͕ڧྗͰ͋Δ
    ྫ֎Λ໌֬ʹॲཧͰ͖Δ
    Ћ

    View full-size slide

  61. ศརͳ΋ͷ͕୔ࢁ͋Γɺ։ൃεϐʔυ͕ૣ͍
    w *%&͕ڧྗ

    ϦϑΝΫλϦϯάҰͭͰ΋ݡ͍ػೳ͕උΘ͍ͬͯΔ΋ͷ͕͋Δ

    ิ׬͕ڧྗɺ$POWFSU5P,PUMJOͱ͔·Ͱ͋Δ

    ॻ͘εϐʔυ͕ૣ͘ͳΔ
    w ඪ४ϥΠϒϥϦ͕ॆ࣮͍ͯ͠Δ

    ϥΠϒϥϦΛ୳͕࣌ؒ͢ݮΔͷͰ࣮૷ʹूதͰ͖Δ
    ʲЋʳ

    ։ൃ؀ڥ͕ڧྗͳ࿩
    !61

    View full-size slide

  62. ศརͳ΋ͷ͕୔ࢁ͋Γɺ։ൃεϐʔυ͕ૣ͍
    ॳ৺ऀͰ΋ʮ·ͣಈ͘΋ͷʯ͕ग़དྷ্͕Δ·Ͱ͕ૣ͍
    w ࠔͬͨˠͰָ͖͍͕ͨ͠ૣ͍
    w ࣗ৴ͱ͔Ϟνϕʔγϣϯʹ௚݁͢Δ
    ʲЋʳ
    ։ൃ؀ڥ͕ڧྗͳ࿩
    !62

    View full-size slide

  63. ʲ͓·͚ʳ

    +%,ͷҠߦͷ࿩

    View full-size slide

  64. w ϐΫτϦϯΫͰ͸0SBDMF+%,Λ࢖͍ͬͯͨ
    +%,ͷҠߦ
    !64
    0SBDMF
    +%,ʙ̇

    View full-size slide

  65. w ϐΫτϦϯΫͰ͸0SBDMF+%,Λ࢖͍ͬͯͨ
    w 0SBDMFͷαϙʔτϙϦγʔ͕มΘͬͨ

    ࣮ӡ༻Ͱ࢖͑Δ+%,͸೥݄·Ͱ

    Ҿ͖ଓ͖࢖͏ʹ͸ܖ໿͕ඞཁ

    ͦΕ΋೥ؒͰαϙʔτऴྃͷ༧ఆ

    +%,Ҏ߱΋ಉ͘͡ܖ໿͕ඞཁ
    w Կ͔͠ΒରԠΛ͠ͳͯ͘͸ͳΒͳ͍ঢ়گ
    +%,ͷҠߦ
    !65
    αϙʔτ
    ऴΘΔΑʂ

    View full-size slide

  66. ߟ͑ΒΕΔબ୒ࢶ͸͍͔ͭ͘
    w 0SBDMF+%,Ͱܖ໿͢Δ
    w 0SBDMF+%,Ͱܖ໿͢Δ
    w ֤ࣾஂମͷ+%,ʹҠߦ͢Δ
    w ͍ͬͦଞͷݴޠʹͯ͠͠·͏
    +%,ͷҠߦ
    !66

    View full-size slide

  67. ߟ͑ΒΕΔબ୒ࢶ͸͍͔ͭ͘
    w 0SBDMF+%,Ͱܖ໿͢Δ
    w 0SBDMF+%,Ͱܖ໿͢Δ
    w ֤ࣾஂମͷ+%,ʹҠߦ͢Δ
    w ͍ͬͦଞͷݴޠʹͯ͠͠·͏
    +%,ͷҠߦ
    !67
    ͙͢ʹରԠ͢Δͷ͸೉͍͠
    ͙͢ʹରԠ͢Δͷ͸೉͍͠
    ͳ͔ͳ͔ͷֹۚʹͳΓͦ͏ʜ
    ͳ͔ͳ͔ͷֹۚʹͳΓͦ͏ʜ

    View full-size slide

  68. w ͻͱ·ͣ"EPQU0QFO+%,ʹҠߦ͢Δ͜ͱʹ
    w खॱʹಛผͳ͜ͱ͸ͳ͍
    w ΞϓϦέʔγϣϯ͔Β"EPQU0QFO+%,Λࢀর͢ΔΑ͏ʹ͢Δ
    w ςετ؀ڥͰϏϧυɺϢχοτςετ͕௨Δ͔νΣοΫ
    w ϲ݄΄Ͳςεταʔόʔʹஔ͍ͯΞϓϦέʔγϣϯΛ৮Γ͓ͨ͢
    w όά౳Έ͋ͨΒͳ͚Ε͹ϦϦʔε
    +%,ͷҠߦ
    !68
    ࠓίί

    View full-size slide

  69. ࠓޙ
    w վΊͯͲͷ+%,ʹ͢Δͷ͔
    w +BWBͷόʔδϣϯ΋Ͳ͏͢Δͷ͔
    ͳͲΛݕ౼ͯ͠௥ͬͯରԠΛ͍ͯ͘͠༧ఆ
    +%,ͷҠߦ
    !69

    View full-size slide

  70. ͱɺ͞Βͬͱ࿩͕͓ΘΓ·͕ͨ͠
    +%,ͷҠߦ
    !70

    View full-size slide

  71. w ରԠ͢ΔதͰɺ+BWBࣗମʹର͢ΔࠔΓ͝ͱ͸ಛʹແ͔ͬͨ
    w ਓͰ೰·ͳͯ͘΋ɺੈքதͷਓͷҙݟ͕ಘΒΕΔ
    w 0SBDMFҎ֎ʹ΋+%,ͷఏڙऀ͕͍Δ
    w ݟ͔ͭͬͨ՝୊͸ࣾ಺ͷ໰୊͹͔Γ
    w ৽͍͠όʔδϣϯʹ͙͢ʹରԠͰ͖ͳ͍ঢ়گΞʔΩςΫνϟ
    +%,ͷҠߦ
    !71

    View full-size slide

  72. ྺ࢙తܦҢ

    ࣾ಺ʹઌʹ஌ݟ͕͋ͬͨɺଞͷબ୒ࢶͷͳ͞
    ݴޠͷϢʔβʔ͕ଟ͍
    ੩తܕ෇͚ͰίϯύΠϥ͕ڧྗͰ͋Δ
    ྫ֎Λ໌֬ʹॲཧͰ͖Δ
    ϐΫτϦϯΫ͕+BWBͰ͋Δཧ༝
    !73

    View full-size slide

  73. !74
    ʮ+BWB͕దͨ͠αʔϏεͱ͸Կ͔ʯ

    View full-size slide

  74. !75
    w Ϣʔβʔ਺͕ଟ͘ɺن໛͕େ͖͍αʔϏε
    w ίϛοτ͢Δϝϯόʔ͕มԽ͠΍͍͢ɺ

    ͍ͭ୭͕Ͳ͜Λ৮Δ͔ಡΊͳ͍αʔϏε

    View full-size slide

  75. !76
    w Ϣʔβʔ਺͕ଟ͘ɺن໛͕େ͖͍αʔϏε
    w ίϛοτ͢Δϝϯόʔ͕มԽ͠΍͍͢ɺ

    ͍ͭ୭͕Ͳ͜Λ৮Δ͔ಡΊͳ͍αʔϏε
    Έͳ͞Μͷ͝ҙݟ΋

    ͥͻฉ͖͍ͨͰ͢ʂ

    View full-size slide

  76. !77
    ϐΫτϦϯΫ͸+BWBͰΑ͔ͬͨʁ

    View full-size slide

  77. w ୭͕Ͳ͜Λ͍ͭ৮Δ͔Θ͔Βͳ͍ঢ়ଶ

    গͳ͘ͱ΋νʔϜ͸ίʔυΛ৮ΔڪΕ͕͋ΔϓϩμΫτ

    ͪΐͪ͜ΐ͜ଞ෦໳͔Βਓ͕དྷͨΓνʔϜฤ੒͕มΘͬͨΓ͢Δ

    ͳͷͰ
    w ੩తܕ෇͚Ͱ͋Δ͜ͱͰࣗ෼ͷ஌Βͳ͍ͱ͜Ζ΋ͳΔ΂҆͘શʹ͠΍͍͢
    w ଞ෦ॺ΋+BWBྺͷ͋Δਓ͕ଟ͍ͷͰߦ͖དྷ͠΍͍͢
    ϐΫτϦϯΫ͕+BWBͰ͋Δཧ༝
    !79

    View full-size slide

  78. w Ϣʔβ਺͕ສਓ͍ΔͰ͔͍αʔϏεͰ͋Δ

    ίϯύΠϧஈ֊Ͱ͔ͬ͠ΓνΣοΫͨ͠΋ͷΛੈʹग़ͤΔͷ͸͍ͩ͡

    ϥΠϒϥϦͳͲ΋ϝϯς͞ΕͯΔ΋ͷ͕͔ͭ͑Δͷ͸خ͍͠

    ҆શͳαʔϏεΛఏڙ͠΍͍͢
    w ίʔυͷϘϦϡʔϜɺաڈͷࢿ࢈΋͔ͳΓͰ͔͍

    աڈͷࢿ࢈ͱ͍͏ҙຯͰ͸+7.ݴޠͰ͋Ε͹׆༻Ͱ͖Δ
    ϐΫτϦϯΫ͕+BWBͰ͋Δཧ༝
    !80

    View full-size slide

  79. ͓஌Βͤͦͷ̍
    !82
    Ұॹʹಇ͘ϝϯόʔΛืूதͰ͢ɻ
    ΤϯδχΞืूதʂ

    View full-size slide

  80. ͓஌Βͤͦͷ̍
    !83
    w ژ౎Ӻɹెา෼
    w ΧϯϑΝϨϯε͸ࣾඅͰʂ

    ަ௨අ॓ധඅࢀՃඅ͓څྉग़·͢
    w ࣾ಺Ͱͷษڧձ΋͍Ζ͍Ζ
    w ৄ͘͠͸ͪ͜Β
    ΤϯδχΞืूதʂ

    View full-size slide

  81. ͓஌Βͤͦͷ
    !84
    ژ౎%FW͔;͐
    w ژ౎Ӻલʙ
    w ςʔϚ͸৭ʑ
    w ίʔώʔɺ࠙਌ձ෇͖
    w ৄ͘͠͸DPOOQBTTͰʂ
    ษڧձ΍ͬͯΔͷͰདྷ͍ͯͩ͘͞ʂ

    View full-size slide

  82. ͓஌Βͤͦͷ
    !85
    ొஃऀ΋ืूதͰ͢ʂ
    $G1ग़͔ͨͬͨ͠3FKFDUͩͬͨ

    ࣗ෼͕Έͨηογϣϯ·ͱΊ

    ͳͲͳͲͳΜͰ΋͟͝Εʂ

    View full-size slide

  83. ສϢʔβʔͷ8FCαʔϏεΛ

    ೥ӡ༻ͯ͠ߟ͑Δɺ+BWBͰ͋Δཧ༝
    ϑϦϡʔגࣜձࣾླ໦ਅੜ !NBTBP[Jʣ
    ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ

    View full-size slide