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

抽象化って何? (What is abstraction?)

抽象化って何? (What is abstraction?)

2019年3月30日 PHPerKaigi 2019

hidenorigoto

March 30, 2019
Tweet

More Decks by hidenorigoto

Other Decks in Programming

Transcript

  1. ந৅ԽͬͯԿʁ
    ޙ౻लએ
    IJEFOPSJHPUP!HNBJMDPN

    1)1FS,BJHJWFS
    8IBUJTBCTUSBDUJPO

    View Slide

  2. ந৅Խ
    "CTUSBDUJPO

    View Slide

  3. ͜ͷτʔΫͷ໨ඪ

    View Slide

  4. ͜ͷτʔΫͷ໨ඪ
    w ݱ࣮ੈքʹ͓͚Δந৅Խͱ͸ͲͷΑ͏ͳ͜ͱͳͷ͔ɺཧղ͢Δ

    View Slide

  5. ͜ͷτʔΫͷ໨ඪ
    w ݱ࣮ੈքʹ͓͚Δந৅Խͱ͸ͲͷΑ͏ͳ͜ͱͳͷ͔ɺཧղ͢Δ
    w ϓϩάϥϛϯάʹ͓͚Δந৅Խͱ͸ͲͷΑ͏ͳ͜ͱͳͷ͔ɺཧղ͢
    Δ

    View Slide

  6. ͜ͷτʔΫͷ໨ඪ
    w ݱ࣮ੈքʹ͓͚Δந৅Խͱ͸ͲͷΑ͏ͳ͜ͱͳͷ͔ɺཧղ͢Δ
    w ϓϩάϥϛϯάʹ͓͚Δந৅Խͱ͸ͲͷΑ͏ͳ͜ͱͳͷ͔ɺཧղ͢
    Δ
    w ந৅Խͷࢦ਑Λ஌Γɺந৅Խͷྑ͠ѱ͠Λ൑அͰ͖ΔΑ͏ʹͳΔ

    View Slide

  7. ͓୊આ໌

    View Slide

  8. γνϡΤʔγϣϯ
    w ʮ਺ಠʢφϯϓϨɺ/VNCFS1MBDFʣʯͷΞϓϦΛ։ൃ͢Δ

    View Slide

  9. ਺ಠʢφϯϓϨʣͱ͸ʁ

    View Slide

  10. ਺ಠʢφϯϓϨʣͱ͸ʁ
    ݸͷϚεʹ͓͍ͯɺ
    ̍ʙ̕ͷ਺ࣈ͕
    ॏෳ͍ͯ͠ͳ͍͜ͱ

    View Slide

  11. γνϡΤʔγϣϯ
    w ʮ਺ಠʢφϯϓϨɺ/VNCFS1MBDFʣʯͷΞϓϦΛ։ൃ͢Δ
    w ਺ಠͷʮਖ਼ղνΣοΫػೳʯͷ࣮૷Λ୲౰͢Δ
    w ϧʔϧΛຬ͍ͨͯ͠Δ͔Ͳ͏͔ʁ
    w લఏ
    w ਺ಠͷ͢΂ͯͷϚεʹ਺ࣈ͕ೖ͍ͬͯΔ
    w ̍ʙ̕ͷ਺ࣈҎ֎ͷೖྗ͸ͳ͍

    View Slide

  12. ࠷ॳͷίʔυ֓ཁ
    ਺ಠͷϚεͷ৘ใΛ
    ̎࣍ݩ഑ྻͰอ࣋
    ਖ਼ղ͔Ͳ͏͔Λ
    νΣοΫ͢Δ

    View Slide

  13. View Slide

  14. View Slide

  15. B<J><K>
    Jଆ͕ߦ

    View Slide

  16. View Slide

  17. View Slide

  18. վળϙΠϯτ͸ͳ͍͔ʁ
    w ϩδοΫ͸Ͱ͖͍ͯΔɻਖ਼͘͠νΣοΫͰ͖Δɻ
    w ίʔυΛ੔ཧͰ͖Δؾ͕͢Δɻ͔͠͠ɺͲΜͳΞϓϩʔνͰ΍Δͷ͔
    w $IFDLFS͕.BUSJYʹ௚઀ґଘ͍ͯ͠Δͱ͜Ζ͔Βʁ

    View Slide


  19. ґଘͱ͍͑͹ɾɾɾ
    ґଘؔ܎ٯసͷݪଇʢ%*1ʣ
    ͬͯϠπΛ࢖͏ͷ͔ͳɾɾɾ
    ্ҐϨϕϧͷϞδϡʔϧ͸ԼҐϨϕϧͷϞδϡʔ
    ϧʹґଘ͢΂͖Ͱ͸ͳ͍ɻ྆ํͱ΋ந৅
    ʢBCTUSBDUJPOT
    ʹґଘ͢΂͖Ͱ͋Δɻ

    View Slide

  20. ґଘؔ܎ٯసͷݪଇͬͯɺ
    ؒʹJOUFSGBDFΛ͸͞Ήܗʹ
    ͢Ε͹ྑ͍ΜͩΑͳɻ
    ˞஫ҙɿԋग़ͷ౎߹্ͷɺۃ୺ͳཧղྫͰ͢

    View Slide

  21. ґଘؔ܎ٯసʂ௚઀ґଘͯ͠·ͤΜʂ

    View Slide

  22. Կ͔ؒҧ͍ͬͯΔ
    ؾ͕͢Δ

    View Slide

  23. Ͳ͕ؒ͜ҧ͍ͬͯΔͷ͔આ
    ໌͍ͯͩ͘͠͞ʂ

    View Slide

  24. Ͳ͕ؒ͜ҧ͍ͬͯΔͷ͔ʁ

    View Slide

  25. ந৅Խͱ͸

    View Slide

  26. ࣙॻతఆٛ
    ந৅ʢͪΎ͏͠ΐ͏ʣ
    ࣄ෺΍ද৅Λɺ͋Δੑ
    ࣭ɾڞ௨ੑɾຊ࣭ʹண
    ໨͠ɺͦΕΛந͖ग़͠
    ͯ೺Ѳ͢Δ͜ͱɻ
    ࣺ৅ʢ͠Ό͠ΐ͏ʣ
    ֓೦Λந৅͢Δࡍʹɺ
    ந৅͞Εͨॾද৅Ҏ֎
    ͷද৅Λߟ࡯ͷର৅͔
    Β੾ΓࣺͯΔ͜ͱɻ

    View Slide

  27. 4ɾ*ɾϋϠΧϫʮந৅ͷϋγΰʯ
    ʰࢥߟͱߦಈʹ͓͚ΔݴޠʱQ
    ܦݧͷର৅ʢ໒ڇʣ
    Պֶతঢ়ଶʢ໒
    ϕογʔ
    ޠʮ໒ڇʯ
    Ոச
    ೶৔ࢿ࢈
    ࢿ࢈









    ݴޠ
    ந৅Խ
    ந৅Խ
    ந৅Խ

    View Slide

  28. ܦݧͷର৅ʢ໒ڇʣ
    Պֶతঢ়ଶʢ໒ڇʣ
    ϕογʔ
    ޠʮ໒ڇʯ
    Ոச
    ೶৔ࢿ࢈
    ࢿ࢈









    View Slide

  29. ϕογʔ
    ܦݧͷର৅ʢ໒ڇʣ
    Պֶతঢ়ଶʢ໒ڇʣ
    ϕογʔ
    ޠʮ໒ڇʯ
    Ոச
    ೶৔ࢿ࢈
    ࢿ࢈









    View Slide

  30. ໒ڇ
    ϕογʔ
    ܦݧͷର৅ʢ໒ڇʣ
    Պֶతঢ়ଶʢ໒ڇʣ
    ϕογʔ
    ޠʮ໒ڇʯ
    Ոச
    ೶৔ࢿ࢈
    ࢿ࢈









    View Slide

  31. ந৅Խʹ͓͚ΔมԽ
    ϕογʔ ޠʮ໒ڇʯ

    ந৅Խ
    ಛ௃ͷྔ ଟ͍ গͳ͍
    ର৅ͷ਺ গͳ͍ ଟ͍

    View Slide

  32. ந৅Ϩϕϧ͕͓͔͍͠จ
    ܦݧͷର৅ʢ໒ڇʣ
    Պֶతঢ়ଶʢ໒
    ϕογʔ
    ޠʮ໒ڇʯ
    Ոச
    ೶৔ࢿ࢈
    ࢿ࢈









    ࢲ͸໌೔ͷேɺࢲୡͷࢿ࢈ʹ㕒
    Λ༩͑ͳ͚Ε͹͍͚ͳ͍
    ࢿ࢈

    ผͷந৅
    Ϩϕϧ͕
    ࠞࡏ͍ͯ͠
    Δʂ

    View Slide

  33. ந৅Խͷ·ͱΊ
    w ந৅ʹ͸Ϩϕϧ͕͋Δʢந৅ͷϋγΰʣ
    w ϋγΰΛ্Δʹ͸ɺಛ௃Λ੾Γࣺͯͯந৅Խ͢Δ

    ಛ௃ྔ͸ݮΔ͕ɺΑΓଟ͕͘ର৅ʹೖΔ
    w ந৅ͷϨϕϧ͕ἧ͍ͬͯͳ͍ͱɺίϛϡχέʔγϣϯͰ͖ͳ͍

    View Slide

  34. ϓϩάϥϛϯάʹ͓͚Δ
    ந৅Խͱ͸

    View Slide

  35. ݱ࣮ੈքɺϓϩάϥϛϯάͷੈք

    View Slide

  36. ݱ࣮ੈքɺϓϩάϥϛϯάͷੈք
    ࢿ࢈

    ͓ۚ
    ϕογʔ

    View Slide

  37. ݱ࣮ੈքɺϓϩάϥϛϯάͷੈք
    ࢿ࢈

    ͓ۚ
    ϕογʔ
    ฼ࠃޠɺߏจɺޠኮ

    ۩

    View Slide

  38. ݱ࣮ੈքɺϓϩάϥϛϯάͷੈք
    ࢿ࢈

    ͓ۚ
    ϕογʔ
    .BUSJY
    νΣοΫ
    Ϛε
    ϧʔϧ
    ฼ࠃޠɺߏจɺޠኮ

    ۩

    View Slide

  39. ݱ࣮ੈքɺϓϩάϥϛϯάͷੈք
    ࢿ࢈

    ͓ۚ
    ϕογʔ
    .BUSJY
    νΣοΫ
    Ϛε
    ϧʔϧ
    ฼ࠃޠɺߏจɺޠኮ ϓϩάϥϛϯάݴޠɺߏจɺޠኮ

    ۩

    View Slide

  40. ϓϩάϥϛϯάʹ͓͚Δந৅Խͱ͸
    ѻ͍ͬͯΔ໰୊΍֓೦ͷந৅Խ
    *OUFSGBDF΍"CTUSBDUDMBTTΛ࢖͏͜
    ͱ
    ͜ΕΛୡ੒͢ΔͨΊʹɺݴޠʹ༻ҙ͞Ε
    ͍ͯΔ༷ʑͳػೳΛ࢖͏ʢ*OUFSGBDFɺ
    "CTUSBDUɺFUDʣ

    View Slide

  41. ࢦ਑͸ʁ

    View Slide

  42. ϓϩάϥϛϯάʹ͓͚Δ໰୊ͷந৅Խͷࢦ਑ Ծ

    ద੾ͳ໋໊
    ໊લͱ಺༰͕Ұக
    ͍ͯ͠Δ͜ͱ
    ந৅౓ͷ౷Ұ
    ͋Δଆ໘͕औΓग़
    ͞Εͨ΋ͷ͚ͩͰ
    ⁋᧒͕߹͏͜ͱ
    ڱ͍ൣғ
    ߟྀ͢Δಛ௃ͷ਺
    ͕খ͘͞ͳ͍ͬͯ
    Δ͜ͱ
    ˞஫ҙɿIJEFOPSJHPUPʹΑΔࡶͳఏҊͰ͢

    View Slide

  43. ͜ͷந৅Խ͸Կ͕ؒҧ͍ͬͯͨʁ

    View Slide

  44. ͜ͷந৅Խ͸Կ͕ؒҧ͍ͬͯͨʁ
    ద੾ͳ໋໊

    View Slide

  45. ͜ͷந৅Խ͸Կ͕ؒҧ͍ͬͯͨʁ
    ந৅౓ͷ౷Ұ

    View Slide

  46. ଞʹϝιου
    ͕͋Δ
    ͚̍ͭͩ
    ͜ͷந৅Խ͸Կ͕ؒҧ͍ͬͯͨʁ
    ڱ͍ൣғ

    View Slide

  47. ͜ͷந৅Խ͸Կ͕ؒҧ͍ͬͯͨʁ
    ڱ͍ൣғ

    View Slide

  48. վળྫ

    View Slide

  49. ґଘؔ܎ͷຊ࣭ΛݟۃΊΔ

    View Slide

  50. ґଘؔ܎ͷຊ࣭ΛݟۃΊΔ
    w $IFDLFSͱ.BUSJYͷຊ࣭తͳؔ܎ɺ໾ׂΛߟ͑Δ

    $IFDLFS͸ɺ࠷௿ݶԿ͕͋Ε͹੹຿ΛՌͨͤΔ͔

    View Slide

  51. ґଘؔ܎ͷຊ࣭ΛݟۃΊΔ
    w $IFDLFSͱ.BUSJYͷຊ࣭తͳؔ܎ɺ໾ׂΛߟ͑Δ

    $IFDLFS͸ɺ࠷௿ݶԿ͕͋Ε͹੹຿ΛՌͨͤΔ͔
    w $IFDLFS͸ɺݸͷ਺ࣈΛड͚औΕ͹ɺͦΕ͕0,͔/(͔Λ൑ఆͰ͖
    Δ

    View Slide

  52. ґଘؔ܎ͷຊ࣭ΛݟۃΊΔ
    w $IFDLFSͱ.BUSJYͷຊ࣭తͳؔ܎ɺ໾ׂΛߟ͑Δ

    $IFDLFS͸ɺ࠷௿ݶԿ͕͋Ε͹੹຿ΛՌͨͤΔ͔
    w $IFDLFS͸ɺݸͷ਺ࣈΛड͚औΕ͹ɺͦΕ͕0,͔/(͔Λ൑ఆͰ͖
    Δ
    w ݸͷ਺ࣈͷ഑ஔ͸ɺ൑ఆʹ͸ؔ܎͕ͳ͍

    View Slide

  53. $IFDLFS͸਺ࣈͷྻ͚ͩΛѻ͏
    ਺ࣈͷίϨΫγϣϯ
    ਺ࣈͷίϨΫγϣϯ
    ͕ਖ਼ղ͔Ͳ͏͔
    νΣοΫ

    View Slide

  54. ਺ࣈͷྻͷੜ੒͸ΞμϓλʔͰٵऩ͢Δ
    .BUSJYͷσʔλΛ
    ਺ࣈͷίϨΫγϣϯ
    ʢͷ഑ྻʣ
    ΁ม׵

    View Slide

  55. View Slide

  56. ਺ࣈͷྻͷੜ੒ίʔυ
    ʢ$IFDLFSͷதʹ͋ͬ
    ͨϧʔϓʹ૬౰ʣ

    View Slide

  57. View Slide

  58. վળલͷ$IFDLFSͱൺֱ

    View Slide

  59. ڱ͍ൣғ΁ந৅Խ
    ந৅౓౷Ұ
    .BUSJYΛѻ͏
    $IFDLFS
    /VNCFS$PMMFDUJPO
    Λѻ͏$IFDLFS
    .BUSJYશମ
    ਺ࣈͷྻ

    View Slide

  60. 6.-
    $IFDLFS͸.BUSJY͔Β੾Γ཭͞Εͨ

    View Slide

  61. ந৅ԽͷԸܙ
    w $IFDLFSΫϥεͷίʔυ͕ݮͬͨ
    w $IFDLFSΫϥεͷґଘର৅͕খ͘͞ͳͬͨ

    View Slide

  62. ·ͱΊ

    View Slide

  63. ͜ͷτʔΫͷ໨ඪ
    w ݱ࣮ੈքʹ͓͚Δந৅Խͱ͸ͲͷΑ͏ͳ͜ͱͳͷ͔ɺཧղ͢Δ
    w ϓϩάϥϛϯάʹ͓͚Δந৅Խͱ͸ͲͷΑ͏ͳ͜ͱͳͷ͔ɺཧղ͢
    Δ
    w ந৅Խͷࢦ਑Λ஌Γɺந৅Խͷྑ͠ѱ͠Λ൑அͰ͖ΔΑ͏ʹͳΔ

    View Slide

  64. ͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠

    View Slide

  65. ࢀߟ
    w 4ɾ*ɾϋϠΧϫʰࢥߟͱߦಈʹ͓͚Δݴޠʱݪॻୈ࢛൛ؠ೾ॻళ

    View Slide

  66. ந৅ԽτϨʔχϯά

    View Slide

  67. ந৅ԽτϨʔχϯά
    w ຊ࣭Λൃݟ͢ΔεΩϧΛຏ͘ʹ͸ʁ

    View Slide

  68. ந৅ԽτϨʔχϯά
    w ຊ࣭Λൃݟ͢ΔεΩϧΛຏ͘ʹ͸ʁ
    w ਺ֶ

    View Slide

  69. ந৅ԽτϨʔχϯά
    w ຊ࣭Λൃݟ͢ΔεΩϧΛຏ͘ʹ͸ʁ
    w ਺ֶ
    w ࿦ཧֶ

    View Slide

  70. ந৅ԽτϨʔχϯά
    w ຊ࣭Λൃݟ͢ΔεΩϧΛຏ͘ʹ͸ʁ
    w ਺ֶ
    w ࿦ཧֶ
    w ΞϧΰϦζϜ

    View Slide