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

「SOLIDの原則って何ですか?」って質問に答えたかった / What's SOLID pri...

「SOLIDの原則って何ですか?」って質問に答えたかった / What's SOLID principle

書籍を読んでもわりと唐突に始まるSOLIDの原則
いざ自分が説明しようとすると結構難儀する代物だと思いますので、それっぽく説明ができるように調べたみたお話です

Satoshi Kawashima

January 30, 2019
Tweet

More Decks by Satoshi Kawashima

Other Decks in Programming

Transcript

  1. Single responsibility principle Open/closed principle Liskov substitution principle Interface segregation

    principle Dependency inversion principle ୯Ұ੹೚ͷݪଇ ։์ด࠯ͷݪଇ Ϧείϑͷஔ׵ݪଇ ΠϯλʔϑΣʔε෼཭ͷݪଇ ґଘੑٯసͷݪଇ 40-*%ͷݪଇ
  2. Single responsibility principle Open/closed principle Liskov substitution principle Interface segregation

    principle Dependency inversion principle ୯Ұ੹೚ͷݪଇ ։์ด࠯ͷݪଇ Ϧείϑͷஔ׵ݪଇ ΠϯλʔϑΣʔε෼཭ͷݪଇ ґଘੑٯసͷݪଇ 40-*%ͷݪଇ
  3. 40-*%ͷݪଇ Single responsibility principle Open/closed principle Liskov substitution principle Interface

    segregation principle Dependency inversion principle ୯Ұ੹೚ͷݪଇ ։์ด࠯ͷݪଇ Ϧείϑͷஔ׵ݪଇ ΠϯλʔϑΣʔε෼཭ͷݪଇ ґଘੑٯసͷݪଇ ͬͪ͜͡Όͳͯ͘
  4. Single responsibility principle Open/closed principle Liskov substitution principle Interface segregation

    principle Dependency inversion principle ୯Ұ੹೚ͷݪଇ ։์ด࠯ͷݪଇ Ϧείϑͷஔ׵ݪଇ ΠϯλʔϑΣʔε෼཭ͷݪଇ ґଘੑٯసͷݪଇ 40-*%ͷݪଇ ͬͪ͜ʂʂʂʂ
  5.  ΫϥεϞδϡʔϧ͸֦ுʹରͯ͠։͖ɺमਖ਼ʹରͯ͠͸ด͡ͳ͚Ε͹ͳΒͳ͍ʢ#FSUSBOE.FZFSͷΦʔϓϯΫϩʔζυͷݪଇʣ  ೿ੜΫϥε͸جຊΫϥεͱަ׵ՄೳͰͳ͚Ε͹ͳΒͳ͍ʢ-JTLPWͷஔ׵ݪଇʣ  ৄࡉ͸ந৅ʹґଘ͠ͳ͚Ε͹ͳΒͣɺந৅͸ৄࡉʹґଘͯ͠͸ͳΒͳ͍ʢґଘੑٯసͷݪଇʣ  ࠶ར༻ͷཻ౓ͱϦϦʔεͷཻ౓͸ಉ͡ʹ͢΂͖  ಉ͡ཧ༝Ͱมߋ͞ΕΔΫϥε܈ΛҰͭͷίϯϙʔωϯτʹ·ͱΊΔ͜ͱ

     ίϯϙʔωϯτͷϦϦʔε͞ΕΔ୯Ґͱ࠶ར༻ͷ୯Ґ͸ಉ͡Ͱ͋Δ΂͖  ϦϦʔε͞Εͨίϯϙʔωϯτؒͷґଘؔ܎͸॥؀ͯ͠͸ͳΒͳ͍  ϦϦʔε͞Εͨίϯϙʔωϯτؒͷґଘͷํ޲͸ɺΑΓ҆ఆͨ͠ํ޲ʹ޲͍ͯͳ͚Ε͹ͳΒͳ͍  ΑΓ҆ఆͨ͠ίϯϙʔωϯτ͸ΑΓଟ͘ͷந৅ΫϥεͰߏ੒͞ΕΔ΂͖ ՄೳͳݶΓ࣮ূࡁΈͷύλʔϯΛ࢖༻ͯ͠ઃܭ্ͷ໰୊Λղܾ͢Δ ͭͷύϥμΠϜΛލ͙࣌͸ඞͣ྆ऀΛ෼͚ΔΠϯλʔϑΣʔεϨΠϠʔΛ੾Δ͜ͱ طʹ40-*%ͷݪଇͷݪܕ͕͋ͬͨ 3PCFSU$.BSUJOͷ౤ߘ ˢʂʁ