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

Peacock#01 ソフトウェアアーキテクチャ的発想

kinocoboy
November 30, 2021
140

Peacock#01 ソフトウェアアーキテクチャ的発想

kinocoboy

November 30, 2021
Tweet

Transcript

  1. Peacock #01
    ଎߈࢖͑!! ιϑτ΢ΣΞΞʔΩςΫνϟతൃ૝

    View full-size slide

  2. Self Introduction
    Hiroki.Kinoshita


    Peacock Engineer Group ( PEG )


    Organizer


    גࣜձࣾKUNO


    ਂ૚ֶशͱCloudΛۦ࢖͢ΔDXਪਐاۀ


    Front Engineer / Designer


    Twitter: @kinocoboy2


    Blog: Baboblog


    View full-size slide

  3. Peacock Engineer Group ͷ঺հ

    View full-size slide

  4. Peacock Engineer Group
    • PEG ͷ ໨త


    • ஍Ҭ΍ձࣾɾࣾձਓɾֶੜͳͲͷ֞ࠜΛӽ͑ͯɺ
    ࣗ༝ʹָٕ͘͠ज़ྗΛߴΊ߹͑ΔίϛϡχςΟ
    ʹ!!


    • PEG ͕औΓѻ͏ςʔϚ


    • ʮ໌೔͔Β࢖͑ΔTipsʯ


    • ӡӦελοϑਵ࣌ืूத!

    View full-size slide

  5. Πϕϯτͷָ͠Έํ
    • Twitter ͱSpecialChat Λۦ࢖


    • #PEACOCK


    • ͲΜͲΜᄁ͍͍͖ͯ·͠ΐʔ


    • ࣭໰͸ɺTwitter Ͱ΋͍͍͠ɺSpecialChat ͷ
    νϟοτཝ͔ΒͰ΋OKͰ͢ɻ


    • ΦϯϥΠϯͳͷͰੵۃతʹ΍ͬͯΈ·͠ΐʔ


    • ࠙਌ձ΋༗ࢤͰߦ͍·͢ɻ


    • SpecialChat ͷ ޿৔Ͱߦ͍·͢ɻ


    • ৭ʑަྲྀ͠·͠ΐʔ

    View full-size slide

  6. ଎߈࢖͑!!


    ιϑτ΢ΣΞΞʔΩςΫνϟతൃ૝

    View full-size slide

  7. PMBOK ୈࣣ൛

    View full-size slide

  8. PMBOKͷվఆ
    PMBOK(ϐϯϘοΫ)ͱ͸ɺ


    ੈքதͷϓϩϚωͷ࣮຿Ո͔ΒҙݟΛूΊͯϓϩδΣΫτϚωδϝϯ
    τʹ͍ͭͯ஌ࣝମܥԽ͍ͯ͠Δ෼ް͍ຊɻ


    ࠷ۙɺ݁ߏۀք͕͟Θͭ͘มԽ͕!!


    View full-size slide

  9. ʮ੒Ռ෺ͷఏڙʯ͔ΒʮՁ஋ͷఏڙʯ΁

    View full-size slide

  10. ʮ੒Ռ෺ͷఏڙʯ͔ΒʮՁ஋ͷఏڙʯ΁
    ੈքతʹҊ݅ਐߦ͸ɺ΢ΥʔλʔϑΥʔϧܕ։ൃ͔ΒΞδϟΠϧ։ൃ
    ΁ͷϐϘοτ͕ߦΘΕ༷ͨࢠɻ


    ͞ΒʹɺʮՁ஋Λఏڙ͢ΔʯͨΊʹ͸ʮՁ஋Λݟग़͞ͳ͚Ε͹ͳΒͳ
    ͍ʯͱ͍͏೉͠͞΋ൃੜ͖ͯͨ͠ɻ

    View full-size slide

  11. Ձ஋Λݟग़ͨ͢Ίͷํ๏
    ͦͷͨΊʹɺDDD(υϝΠϯۦಈઃܭ) ΍ ϞσϦϯάɾϢʔβʔετʔ
    ϦʔϚοϐϯάͳͲͷཁ݅Λந৅Խͯ͠੔ཧ͢Δख๏͕Ұؾʹීٴ͠
    ͍ͯΔɻ


    ͔͠͠ɺ͜ͷख๏͸֮͑Ε͹͙͢ʹॱԠͰ͖Δ͔ͱݴ͏ͱNOͩɻ

    View full-size slide

  12. Ձ஋ఏڙܕͷਐΊํ΍Ձ஋ͷ୳ࡧʹ͸ɺࢼߦࡨޡ͠ͳ͕ΒϢʔβʔώ
    ΞϦϯάΛ܁Γฦ͢ඞཁ͕͋Δɻ


    ͦͷεϐʔυ͕଎͘ɺैདྷͷ΢ΥʔλʔϑΥʔϧܕʹ׳Ε͍ͯΔ৔
    ߹ɺϐϘοτʢେ୾ʹࣺͯͯɾ·ͨੜ͔ͯ͠ʣ͕೉͍͠ɻ
    ͳ͙ͥ͢ॱԠͰ͖ͳ͍ͷ͔

    View full-size slide

  13. େ୾ͳ։ൃΛߦ͑ΔΑ͏ʹͳΔͨΊʹɺҎԼख๏͕༗ޮʹͳΔ


    - ෦෼తͳ҆શੑΛৗʹ୲อ͠ଓ͚Δςετۦಈઃܭ


    - ໾ׂΛ໌֬ʹͯ͠ਐΊΔΠϕϯτۦಈઃܭɾΫϦʔϯΞʔΩςΫνϟ


    ͜ΕΛ࢝ΊΔͨΊʹ͸ɺ੹೚ൣғͷ෼ղϊ΢ϋ΢͕͍Δɻ
    େ୾ʹࣺͯͨΓɾੜ͔ͨ͠Γ͢ΔͨΊʹ

    View full-size slide

  14. ςετۦಈઃܭɾΠϕϯτۦಈઃܭɾΫϦʔϯΞʔΩςΫνϟͷೖΓ
    ޱʹཱͭ͜ͱ͕Ͱ͖Δɻ


    ͦͯ͜͠ΕΒΛར༻Ͱ͖ΔΑ͏ʹͳͬͯ͘ΔͱɺDDD΍ϞσϦϯάͳ
    Ͳͷૉૣ͍ϐϘοτ͕ཁٻ͞ΕΔઃܭख๏Ͱ΋ॊೈʹରԠͰ͖ΔΑ͏
    ʹͳͬͯ͘Δɻ


    ࠓճ͸ɺ੹೚ൣғͷ෼ղʹ஫ྗ͍͖͍ͯͨ͠ͱࢥ͏ɻ
    ੹೚ൣғͷ෼ղ͕Ͱ͖ΔΑ͏ʹͳΕ͹

    View full-size slide

  15. ྫ୊
    • ੹೚ൣғͷ෼ղΛ஌Βͣ


    • ಈ͘΋ͷ͚ͩΛ໨ࢦͨ͠ͷͰςετ΋࣮ࡍʹಈ͔
    ͯ͠ΈͨΓ͢Δײ͡


    • ͔֬ʹಈ͕͘…


    • શͯ main ʹ٧ΊࠐΜͰ͍ΔͷͰɺͲ͔͜Ͱτϥ
    ϒϧ͕ى͖ͨΒ main શମΛ debug ͠ͳ͚Ε
    ͹…


    • Main ͷ ςετͬͯ݁ہԿΛνΣοΫ͢Ε͹…
    ͱ͋ΔώϤίʔυ🐥

    View full-size slide

  16. ώϤίʔυͷ੹೚෼ղʹ͸ɺDI(Dependency Injection)ͷߟ͑ํ͕࢖͑
    ͦ͏ͩɻ


    DIͱ͸ɺʮґଘΦϒδΣΫτΛ஫ೖʯͱݺ͹ΕΔσβΠϯύλʔϯͷ
    ࣄɻ


    ͜ΕΛ࢖ͬͯώϤίʔυΛόϥ͍ͯ͜͠͏


    ੹೚෼ղʹ͸

    View full-size slide

  17. ྫ୊
    • ·ͣҰ൪ͪ͝Ό͍͍ͭͯΔdatabase ૄ௨पΓ͔Βɻ


    • Main Λಈ͔͢ͱ͖ɺdatabase instance ·Ͱཱͪ
    ্͔͛ͯΒquery Λൃߦ͢Δ࢓૊Έʹͳ͍ͬͯ
    Δɻ


    • ·ͣ͸ query ͷ෦඼ͷ੹೚ൣғΛ֎ͯ͠ΈΔɻ


    • Query Λ࣮ߦ͢ΔͨΊʹ͸ɺ database instance
    ͱ query param ͕͋Ε͹෼ղͰ͖ΔͷͰɺ
    model ͱ͍͏ྖҬΛ࡞ͬͯDBͱ΍ΓͱΓΛͤ͞
    ͨɻ


    • ͜ΕʹΑͬͯɺDBपΓͰτϥϒϧ͕ى͖ͨ
    Βɺmodel ͚ͩΛݟΕ͹ྑ͘ͳͬͨ
    ͱ͋ΔώϤίʔυ🐥

    View full-size slide

  18. ྫ୊
    • ࣍ʹmain Λىಈ͢Δͨͼʹຖճ database instance
    up ͍ͯ͠Δ෦෼Λ΍ΊΑ͏ɻ


    • Main Λಈ͔ͨ͢Ίʹɺ model ͕ඞཁͰ͋Γɺ
    model ͸ database instance Λཉ͕͠ΔͳΒɺ
    main ʹ΋ database instance Λ֎͔Β༩͑ͯ͋͛
    Ε͹ྑ͍ɻ


    • ͜ͷରԠͰɺdatabase instance ͸ γεςϜͰ୯
    ҰͰ͋Δܗ͕໿ଋ͞ΕΔɻ͜Ε͸singleton ͱ͍͏
    σβΠϯύλʔϯɻ


    • Main ͷςετΛ͢Δͱ͖ɺ database instance ͱ
    query parameter ΛೖΕͨΒಈ࡞֬ೝ͕औΕΔΑ
    ͏ʹͳͬͨɻ
    ͱ͋ΔώϤίʔυ🐥

    View full-size slide

  19. ྫ୊
    • ࣍ʹbusiness logic Λmain ͔Β෼཭͠Α͏ɻ


    • ͜Εͷ෼཭ʹ͸ɺ query ͷ result ͕͋Ε͹logic
    ͸ճͤͦ͏ͩɻ


    • Main ؔ਺Ͱ͸ͳ͘ɺ logic function ͱͯ͠ߟ͑
    Δɻ


    • Logic Λ෼཭ͤ͞Δ͜ͱͰɺ main ͷಈ࡞֬ೝ
    Ͱඞཁͳ͜ͱ͸ param parse ͱ param
    validate ͷΈ࢒͞Ε͍ͯΔɻ


    • Logic ͸ model result ͕͋Ε͹ɺ୯ମͰςε
    τͰ͖Δ͔Βͩɻ
    ͱ͋ΔώϤίʔυ🐥

    View full-size slide

  20. ᶃ ੹೚෼ղʹ͸ɺDIԽ͕༗ޮɻ


    ᶄ DI͸ʮґଘΦϒδΣΫτ஫ೖʯͱ͍͏σβΠϯύλʔϯɻ


    ᶅ ґଘΦϒδΣΫτΛೖΕΔͨΊʹ͸ɺin, out Λ੔ཧ͠Α͏ɻ


    ᶆ γεςϜͰ୯ҰͰ͋Δ͜ͱΛकΓ͍ͨͳΒɺsingleton ͱ͍͏σβ
    Πϯύλʔϯ͸༗ޮ


    ᶇ ͜ͷ஌ݟ͸ɺϞμϯͳઃܭΛਐΊΔͨΊͷجૅͰ͋Δɻ
    ·ͱΊ

    View full-size slide

  21. ͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠
    ιϑτ΢ΣΞΞʔΩςΫνϟʮతʯൃ૝

    View full-size slide