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

Javaの冗長な構文を愛でてみる / java-redundant-syntax

irof
October 04, 2020

Javaの冗長な構文を愛でてみる / java-redundant-syntax

2020-10-04
J Lang Fest Kansai Online #1
https://kansai-jvm-langs-fest.connpass.com/event/188249/

irof

October 04, 2020
Tweet

More Decks by irof

Other Decks in Technology

Transcript

  1. +BWBͷ৑௕ͳߏจΛ
    ѪͰͯΈΔ
    +-BOH'FTU,BOTBJ0OMJOF
    5
    !JSPG

    View full-size slide

  2. ओʹ+BWBΛ࢖͍ͬͯΔ;ͭ͏ͷϓϩάϥϚ
    ;ͭ͏ಛผͳ͜ͱ͸ͤͣɺ;ͭ͏ͷ͜ͱΛ;ͭ͏
    ʹ͢ΔɻͦΜͳҙਤͰ໊৐ͬͯ·͢ɻ
    ؔ੢+BWBΤϯδχΞͷձʢؔδϟόʣ͔Β͖·ͨ͠
    ݸਓࣄۀओ೥ੜ
    ͓࢓ࣄ͸௿֬౓ͷࡶஊ͔ΒͰ΋͓࢕͍ͯ͠·͢
    ࢓ࣄ͸+BWBͰͷ։ൃʹݶΒ͍ͣΖ͍ΖͰ͢

    View full-size slide

  3. ͸ͳ͢͜ͱ
    ࢲͱ+"7"
    +7.ͱ+BWBͷؔ܎
    +BWB͸৑௕ʁ
    ࢲ͕ࠓճ࿩͔ͨͬͨ͜͠ͱ

    View full-size slide

  4. ࢲͱ+"7"
    ݱࡏ鱳KBWBDPN鱴鲿鲮鲜鳫鱑่鲑鱫鱉鲐ɻ
    鱭鱫鲇൵鱜

    View full-size slide

  5. ࢲʹͱͬͯͷ+BWB
    ೥Ҏ্฼ࠃޠͱͯ͠࢖༻
    ೔ຊޠΑΓॻ͚Δͱࢥ͏
    ͭ·Γ೔ຊޠྗ͕ʢলུ͞Ε·ͨ͠ʣ
    ࢓ࣄͰͷϛχϚϜ͸+BWB
    ࠷৽ͱൺ΂Δͱະຬɻ

    View full-size slide

  6. ࢲʹͱͬͯͷ+BWB
    ԿΛ͢Δʹͯ͠΋ʮ࠷଎Ͱ࣮֬ʹ
    ࣮૷Ͱ͖Δ΋ͷʯ͸+BWB
    ଞͷݴޠ΋ͦΕͳΓʹ΍ͬͯΔ͚Ͳ
    ͳͷͰࢥߟ΋+BWBʹدͬͯΔ
    ࢥߟ͸ݴޠͷ੍໿Λड͚Δ͔Β࢓ํͳ͍

    View full-size slide

  7. ࠷ॳͷݴޠͷ঺հ
    Ұͭͷݴޠʹʮਫ਼௨ʯ͠·
    ͠ΐ͏ɻŧŔŕŪũƄŝſɻ
    ʮ+BWBŧŔŕŪũƄŝſʁʯͱฉ͔ΕΔͱ
    ࢲ΋एׯ᪳᪯͍͸͋Δ͚Ͳ
    ͲͷݴޠͰ͋Δ͔͸ॏཁͰ͸
    ͋Γ·ͤΜ
    ͕ɺͦͷݴޠͱ௕͘෇͖߹͏ͭ΋
    ΓͰ޲͖߹͍·͠ΐ͏

    View full-size slide

  8. +7.
    +-BOH'FTU,BOTBJͱ͍͏͜ͱ
    Ͱɺ+7.Λ஌Βͳ͍ਓ͸ډͳ͍ͱ
    ࢥ͍·͢
    ʮ஌ͬͯΔʯͷ౓߹͍΋·ͪ·ͪ
    Ͱ͠ΐ͏͚Ͳ
    KZVLVUZPͷ࿩ͷ൓ԠͬͯͲ͏ͳΜͩΖ

    View full-size slide

  9. +7.ͱ+BWB
    +BWBͷେ͖ͳޭ੷ͷҰͭ͸+7.
    Λҭ͖ͯͯͨ͜ͱ
    গ͠લ͔Βଞͷ+7.ݴޠ͕+7.Λҭͯ
    ͯɺͦΕΛ+BWB͕࢖͏ͬͯ޲͖΋Ͱ͖
    ͖͚ͯͨͲɻ

    View full-size slide

  10. +BWBͷཱͪҐஔ
    +7.͕࣮ߦ͢ΔόΠφϦΛ࠷΋ૉ௚
    ʹදݱͰ͖Δݴޠ
    Ұ෦ͷߏจҎ֎͸KBWBQͨ͠ΒͲ͏ͳΔ͔
    ͸૝૾ͭ͘ɻଞݴޠΑΓ΋ڑ཭͕͍ۙɻ
    ͳͷͰίʔυͷՄࢹԽ͸
    $MBTTΛର৅ʹͯ͠Δˠ
    ଞݴޠͰ΋࢖͑Δ͚Ͳɺ༧ଌͰ͖ͳ͍ϊΠζ͕ʜʜ
    IUUQTHJUIVCDPNEEEKBWBKJH

    View full-size slide

  11. +BWB͸৑௕͔

    View full-size slide

  12. ৑௕
    ͍ΖΜͳจ຺Ͱʮ+BWB͸৑௕ʯ
    ͱݴΘΕ·͢ɻ
    ͚Ͳ࣮ମ͸͋·ΓΈ͑·ͤΜɻ
    จ຺͕·ͪ·ͪա͗ͯΧΦε
    ʮ৑௕ʯͬͯͳΜͩΖ͏ͬͯɻ

    View full-size slide

  13. ৑௕ͩͱ·͍ͣ͜ͱ
    ॻ͖ͮΒ͍
    ಡΈͮΒ͍

    View full-size slide

  14. ৑௕ͳͷͰॻ͖ͮΒ͍
    ৑௕͔ͩΒॻ͘ͷʹ͕͔͔࣌ؒ
    Δͷ͸େ໰୊
    Ͱ΋ଟ෼ͦΕɺ+BWBͷ͍ͤ͡Ό
    ͳ͍ͱࢥ͏ΜͰ͢

    View full-size slide

  15. ৑௕ͳͷͰॻ͖ͮΒ͍
    ΄ͱΜͲ
    શ෦͡Όͳ͍

    ͸*%&͕ղܾࡁΈ
    ࠓ࣌*%&Λ࢖Θͳ͍ͷ͸ߟ͑ͮΒ͍
    ·͔͞શจࣈλΠϐϯάͳΜͯ͠
    ͯ·ͤΜΑͶʁ
    ͜Ε͸ۃ୺͚ͩͲʮ·͔͞˓˓·ͤΜ
    ΑͶʁʯ͸͍͘ΒͰ΋͋Δ

    View full-size slide

  16. ·͔͞˓˓·ͤΜΑͶʁ
    ·͔͞JNQPSUจΛखͰॻ͍ͯ·ͤΜΑͶʁ
    ·͔͞GPSจΛશ෦ॻ͍ͯ·ͤΜΑͶʁ
    ·͔͞JGจΛશ෦ॻ͍ͯ·ͤΜΑͶʁ
    ·͔͞ϑΟʔϧυΛ࡞ͬͯίϯετϥΫλ
    Ͱ୅ೖͱ͔શ෦ॻ͍ͯ·ͤΜΑͶʁ
    Ұྫʹ͗͢ͳ͍ɻ

    View full-size slide

  17. ৑௕ͩͱ·͍ͣ͜ͱ
    ॻ͖ͮΒ͍
    ಡΈͮΒ͍
    ৑௕จ຺Ͱ͜ΕΛڍ͛Δͷ͸
    ʮࢲ͸*%&Λ࢖͍ͬͯ·ͤΜʯʹ͍ۙ

    View full-size slide

  18. ৑௕ͳͷͰಡΈͮΒ͍
    ͕ͬͪ͜࿦ͣΔՁ஋ͷ͋Δ࿩
    ʮ+BWB͸৑௕ʯͱݴ͏ͳΒ͜͜
    ͔Β߈ΊΑ͏
    ߈ΊͯͲ͏͢Δ

    View full-size slide

  19. ಡΈʹӨڹ͢Δ৑௕
    ಡΜͰ΋৘ใྔ͕૿͑ͳ͍
    ৘ใ͕૿͑ΔͳΒ৑௕ͱݴ͑ͳ͍
    ΑΓ؆ܿͳදݱ͕͋Δ
    ಉ͡৘ใྔͰͦΕͳΒ৑௕ͱݴ͑Δ
    ݴޠʗඪ४ϥΠϒϥϦͷදݱྗ͕ऑ͍

    View full-size slide

  20. େࣄͳͷ͸Մಡੑ
    ৑௕͸ՄಡੑΛଛͶΔ͔Β໰୊
    ʮಡΈʹ͍͘ʯͷҰҼʹͳΓ͑Δ
    Մಡੑ্͕͕Δ৑௕͸໰୊ͳ͍
    ʢ͋ΓಘΔ͔͸ผͱͯ͠ʣ

    View full-size slide

  21. ݴޠͷදݱྗʹ͍ͭͯ
    ࠓճ͸ѻ͍·ͤΜ
    ෼ͰೖΒͳ͍ʜʜ
    ݴޠ΍ඪ४ϥΠϒϥϦͷڧྗ͞͸
    ઃܭͷ੿͞Λ෴͍Ӆ͢͜ͱ͋Γ·
    ͢ɻରশੑΛଛͶͯΔͷʹؾ͚ͮ
    ͳ͍ͱ͔ɻ

    View full-size slide

  22. ίʔυ͸ಡΈ෺Ͱ͢
    鱺鱩鱋鱳+BWB鲫鱅鲿鲛鳫鲨++6($$$4QSJOH
    IUUQTTQFBLFSEFDLDPNJSPGIVUVVGBMTFKBWBLPEFJOHVOVNCFSDDDF
    鲫鱅鳁鲗鱮鲃鲘鱯鱐鱰%FW-07&ؔ੢DPNNJUNFOU
    IUUQTTQFBLFSEFDLDPNJSPGLPEPXPEPNBOOBLBOJ

    View full-size slide

  23. ৑௕ͳ+BWBίʔυ

    View full-size slide

  24. ϘΠϥʔϓϨʔτίʔυ
    ग़య͸8JLJQFEJBʢ͖Γͬ
    ʮݴޠ࢓্༷লུෆೳʯ
    ͑ɺHFUUFSTFUUFSͬͯผʹݴޠ࢓༷Ͱ͸ͳͯͩ͘ͳʜʜ
    ·͊ଟ͘ͷϥΠϒϥϦ͕ཁٻ͢Δ΋ͷͰ͸͋ΔͷͰ࣮࣭తʹ
    ͸ͬͯײ͡ͷ΋ؚΊΕ͹͍͍ΜͩΖ͏͚Ͳɻ

    View full-size slide

  25. ଟ͘ͷʮϘΠϥʔϓϨʔτίʔ
    υʯͱݴΘΕΔ΋ͷ͸ʮͦ͏ݴ
    ͏࢖͍ํͨ͠ΒཁΔΑͳ͊ʯͬ
    ͯͷ͕ਖ਼௚ͳͱͩͬͨ͜Γ͢Δ
    ʢͨͩͷײ૝

    View full-size slide

  26. ݴޠ࢓্༷ͷվળྫ
    USZXJUISFTPVSDFT
    μΠΞϞϯυΦϖϨʔλʔ
    WBS
    鱘鲑鲎鱴৑௕鱳ղফ鱯鱳鱐ʁ

    View full-size slide

  27. USZXJUISFTPVSDFT
    ΛѪͰΔ
    Ѫ鱬鲐ʹஸೡ鱰ݟ鲐鱔鲎鱉鱳ײ鱝鱬࢖鱨鱫鲃鱞

    View full-size slide

  28. USZXJUISFTPVSDFT
    ϦιʔεͷࣗಈDMPTFͱͯ͠ೝࣝ͞Ε
    Δ΋ͷ
    ଞݴޠ࢖ͬͯͯʮཉ͍͠ͳʔʯͱ
    ࢥͬͯͨච಄
    ͪͳΈʹ௥Ճ͞Εͨͷ͸େੲ
    ʢόʔδϣϯ൪߸͕൒෼ҎԼʣ

    View full-size slide

  29. ৑௕͔ͷ൑ఆ
    ίʔυ্͸৘ใྔ͕ݮ͍ͬͯΔ
    DMPTF͕ݺ͹ΕΔ͜ͱ΍ͦͷ৚݅
    ಡΈऔΔͷʹ஌͕ࣝ૿͍͑ͯΔ
    ஌͕ࣝ͋Ε͹ಡΈऔΔ଎౓͸্͕Δ
    Մಡੑ͸஌ࣝͱηοτ

    View full-size slide

  30. ৑௕͞͸վળ͞Ε͔ͨ
    :&4
    ࣗ෼Ͱ࣮૷͢Δʹ͸͔ͬͨΔͯ͘
    खΛൈ͍ͯͨͱ͜Ζͱ͔͕͖ͬͪ
    ΓରԠ͞ΕΔΑ͏ʹͳͬͯΔɻ
    TVQQSFTT͕ྫ֎Ͱѻ͑ͯɺෳ਺Ϧιʔε
    ѻ͏࣌ʹ͍͍ײ͡ʹͯ͘͠ΕͯɺӠʑɻ

    View full-size slide

  31. ʮ͔ͬͨΔ͍ʯͷ࿩
    ෳ਺ͷϦιʔεͷղ์Λਖ਼࣮͘͠૷
    ͢Δͷ͸ࠔ೉ͩ͠ɺ௨ৗ͸ෆཁͳ࣮૷
    Ͱ͋Δɻ
    ڵຯ͋Ε͹
    ϒϩάݟͯˠ

    View full-size slide

  32. ৑௕Ͱͳ͘ͳ͔ͬͨ
    ΞϓϦέʔγϣϯϨϕϧͩͱʮUSZʯͬͯͳ
    ΜͩΑײ͸͋Δ
    ʮྫ֎ॲཧʯͱݴ͏৘ใ͸৑௕ͳΜͩΑͶ͐ʜʜ
    ͔֬ʹྫ֎ॲཧͱηοτͳ͜ͱଟ͍Μ͚ͩͲɺผ
    ʹྫ֎ॲཧͨ͘͠ͳͯ͘DMPTF͚͍ͩͨ͠ͷʹ
    USZͬͯͳΜ΍ͶΜͬͯʜʜ

    View full-size slide

  33. ଞݴޠΛݟͯΈΔ
    ʢ׬શʹΠίʔϧ͡Όͳ͍͚Ͳʣ
    +BWB͚ͩྫ֎ॲཧʹࠞͬͯ͟Δɻ
    ʮྫ֎ॲཧͰDMPTF͞ΕΔͱ͔෼͔Δ͔ʂʯ͸؁Μͯ͡ड͚Δɻ
    Ͱ΋ൺֱͯ͠ʮ৑௕ʯͱ͸ݴ͍ͮΒ͍ɻ
    ݴޠ هड़
    +BWB USZ 999

    4DBMB 6TJOH 999

    ,PUMJO 999VTF
    (SPPWZ 999XJUI$MPTFBCMF
    $ VTJOH 999

    View full-size slide

  34. μΠΞϞϯυΦϖϨʔλʔ
    ΛѪͰΔ

    View full-size slide

  35. ͜Ε΋ଠݹͷߋ৽
    ໌֬ͳ৑௕ͷղফ
    ৘ใྔҰ੾ݮΒͣಡΈ΍͘͢ͳͬͨ

    View full-size slide

  36. ࠷ۙೖͬͨ
    ࠷ۙʹόʔδϣϯ͕࠷৽ΑΓେ͖͍
    ͱ͍ͬͯ΋΋͏೥΋ܦͬͯΔ
    ଞݴޠͩͱ͘͝౰ͨΓલʹ͋ͬͨ΍ͭ

    View full-size slide

  37. ͜Ε͸৑௕ͷղফ͔ʁ
    ʮ4PNF5ZQF͕ͭ͋Δ͔Β
    ৑௕ʯ͸ͪΐͬͱҧ͏ɻ

    View full-size slide

  38. ίʔυ͸ࠨ͔ΒಡΉ
    ࠨ୺͸ίʔυͷҰ౳஍
    ͔ͩΒࠨʹॏཁͳ͜ͱΛॻ͖͍ͨ
    ࠷ॏཁͳͷ͸ܕͷ͸ͣʜʜ

    View full-size slide

  39. Ή͠Ζʮม਺Ͱ͋ΔʯͳΜͯ໌
    Β͔ͳ͜ͱΛΘ͟Θ͟ॻ͍ͯɺ
    ৑௕͕͞૿͑ͯͨΓɻ

    View full-size slide

  40. WBS͕ղফͨ͠΋ͷ
    ॻ͘ͷ͸ָʹͳͬͯΔ
    ͚Ͳ·͔͞ม਺ͷܕͱ͔खͰॻ
    ͍ͯ·ͤΜΑͶʁ
    ͋ɺKTIFMMͰ͸ศརɻ

    View full-size slide

  41. ࢲ͕ࠓճ࿩͔ͨͬ͠
    ͨ͜ͱ

    View full-size slide

  42. Մಡੑ͕ॏཁ
    ʮ৑௕͞ʯ͸ՄಡੑʹӨڹΛ༩͑ΔҰ
    Ҽʹա͗ͳ͍
    ৑௕Ͱ΋Մಡੑ্͕͕ΔͳΒ܁Γฦ͠
    ॻ͍ͯ΋͍͍
    هड़ੑ͸ͳΜͱ͔ͳΔɻอकੑʢมߋ࿙Ε
    ͷϦεΫͱ͔ʣ΋ͳΜͱ͔ͳΔɻʮͳΜͱ
    ͔ͳΔʯΛ;ͭ͏ʹ͍ͨ͠ɻ

    View full-size slide

  43. ܕΛॏࢹ͍ͨ͠
    ʮม਺Ͱ͋ΔʯʮϝιουͰ͋Δʯʹίʔ
    υͷҰ౳஍ͨΔࠨ୺ΛৡΓͨ͘ͳ͍
    ͔ͩΒWBSͱ͔GVOͱ͔EFGͱ͔ʹࠨ୺Λ͋͛ͨ
    ͘ͳ͍
    ͱݴ͍ͭͭम০ࢠʹୣΘΕΔ൵͠Έ
    म০ࢠͳ͠Ͱશ෦΍Γ͍ͨ
    ৚݅੔͑ͯ֎ͨ͠Γ͢Δˠ

    View full-size slide

  44. ݴޠͷ৑௕ΛޠΔͳΒ
    ͦͷʮ৑௕ʯ͕Կͳͷ͔ɺ΋͏গ͠ߟ͑ͯ
    ΈΔͱؾ͖͕ͮ͋Δ͔΋͠Εͳ͍ɻ
    ෳ਺ͷݴޠʹڵຯΛ࣋ͬͨͷͳΒɺͦΕͧ
    ΕͷΞϓϩʔνΛݟൺ΂ͯɺղܾͷํ޲ͷ
    ଍͠ʹ͠Α͏ɻ
    ଟ͘ͷʮ৑௕ʯ͸ݴޠ͡Όͳ͘ɺઃܭͷෆ
    ٢ͳʹ͓͍Ͱ͢ɻ޲͖߹͍·͠ΐ͏ɻ

    View full-size slide

  45. ޷͖ͳݴޠ͸μϝͩ͠
    ͯ͠ͳΜ΅ͩͱࢥ͏
    ݴޠEJTฉ鱉鱫鲇ʮ؁鱉鱯鱅EJT鲐鱯鲎鱘鱘鱥
    鲒鱅ʯ鲄鱤鱉鱰ࢥ鱍鲐鱭৺Ժ鲉鱐鱰鱯鲑鲐

    View full-size slide