Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
[デザインパターン勉強会]FactoryMethodパターン
Search
mei28
August 11, 2020
48
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
[デザインパターン勉強会]FactoryMethodパターン
Seeeeee:Dの夏休み勉強会での資料.
mei28
August 11, 2020
Transcript
13 slides
'BDUPSZ.FUIPE 4FFFFFF% ༶໌
w'BDUPSZ.FUIPEͰɼΫϥεͰ͏ΦϒδΣΫτʢΠϯελϯε ͷੜํ๏ʹ͍ͭͯΛߦ͏ɽ wॊೈʹΦϒδΣΫτΛੜ͢Δ͜ͱ͕ՄೳʹͳΔ wܧঝΛར༻͢Δͱ͖ʹ͏σβΠϯύλʔϯ 'BDUPSZ.FUIPEͬͯʁ 5FNQMBUF.FUIPEΛ͏ͪΐͬͱ͍͘͢ʂ
wΠϯελϯεͷੜΛɼநΫϥεʢΫϥεʣʹ͢ΔͷͰͳ͘ɼα ϒΫϥε ࢠΫϥε ʹߦ͏͜ͱͰɼੜ͢ΔΠϯελϯεΛ؆୯ʹมߋ ͢Δ͜ͱ͕Ͱ͖Δɽ wΦϒδΣΫτͷੜΛؔΛܦ༝ͯ͠ߦ͏͜ͱͰ࣮Ͱ͖Δɽ 'BDUPSZ.FUIPEͬͯʁ ࣮ͷͷΓ͔ͨ
͡Ό͋۩ମతʹ
wࠓճྉཧͷઃఆͰΛਐΊ͍ͯ͘ɽ wྉཧ͢ΔਓɼͦΕͧΕϨγϐΛݟͳ͕ΒɼʮΔˠম͘ˠࣽΔʯͷߦಈΛशಘ ͍ͯͯ͠ɼௐཧΛߦ͏ɽ wϨγϐɼ$PPLQBEΫϥγϧͳͲಉ͡৯ࡐͰҟͳΔϨγϐ͕ଘࡏ͢Δɽ ࣮ࡍʹͭͬͯ͘Έͨ ઃఆΛ֬ೝ͍ͯ͘͠Α
ॳ৺ऀ͕ௐཧ͍ͯ͘͠Α /PU'BDUPSZ.FUIPE ͱΓ͋͑ͣ$PPLQBEΛݟΔ͔ class Shoshinsya_Chouri(metaclass=ABCMeta): @abstractmethod def kiru(self): raise
NotImplemented @abstractmethod def yaku(self): raise NotImplemented @abstractmethod def nikomu(self): raise NotImplemented def chouri(self): cookpad = Cookpad(self.shokuzai) self.kiru(cookpad.recipe) self.yaku(cookpad.recipe) self.nikomu(cookpad.recipe) print("Ͱ͖ͨʂ") class Shoshinsya(Shoshinsya_Chouri): def __init__(self, shokuzai): self.shokuzai = shokuzai def kiru(self, cookpad): print(f'{cookpad}Λࢀߟʹͯ͠{self.shokuzai}ΛΔͧ') def yaku(self, cookpad): print(f'{cookpad}Λࢀߟʹͯ͠{self.shokuzai}Λম͍͍ͯ͘') def nikomu(self, cookpad): print(f'{cookpad}Λࢀߟʹͯ͠{self.shokuzai}ΛࣽࠐΉΑ') ΦϒδΣΫτͰ ϨγϐΛࢦఆͯ͠ ݟ͍ͯΔϨγϐ
ผʹ͜ΕͰΑ͘ͳ͍ʁ
Α͘ͳ͍Αʂ
w͜ͷ࣮ํ๏ͩͱɼॳ৺ऀͷௐཧํ๏Λशಘ͍ͯ͠Δਓɼ$PPLQBE͔͠Ϩγϐ ΛݟΔ͜ͱ͕Ͱ͖ͳ͘ͳͬͯ͠·͏ɽ w$PPLQBEҎ֎ݟΔΑͶʁଞͷϨγϐݟ͍ͨΑͶʁʁ Կ͕ྑ͘ͳ͍ͷ͔ $PPLQBE͔͠Ϩγϐݟͳ͍ͷʁ
ਓʹΑͬͯΈΔ Ϩγϐҧ͏ΑͶʁ
͍ΖΜͳϨγϐʹରԠ͠Α͏ 'BDUPSZ.FUIPE αϒΫϥεͰϨγϐΛੜ͍ͯ͘͠Α class Chukyusha_Chouri(metaclass=ABCMeta): #snip def chouri(self): recipe
= self.nanidetsukuru() self.kiru(recipe.recipe) self.yaku(recipe.recipe) self.nikomu(recipe.recipe) print("Ͱ͖ͨʂ") @abstractmethod def nanidetsukuru(self): raise NotImplementedError class Chukyusha(Chukyusha_Chouri): #snip def nanidetsukuru(self): return Kurashiru(self.shokuzai) αϒΫϥεʹ ·͔ͤΔ Ϋϥεʹ͞Ε ͨϨγϐΛܾΊΔ
wॳڃऀͷௐཧํ๏͔͠ձಘ͍ͯ͠ͳ͍ਓɼ$PPLQBE͔͠ϨγϐΛݟΔ͜ͱ͕Ͱ ͖ͳ͔ͨɽ w͔͠͠ɼதڃऀͷௐཧํ๏Λձಘ͍ͯ͠Δਓ$PPLQBEʹͩ͜ΘΒͳ͍ௐཧ͕Ͱ ͖Δɽ wதڃऀ͝ͱʹͦΕͧΕ͕ࣗݟΔϨγϐ͕ੜ͞ΕΔͷͰɼॊೈʹରԠͰ͖Δɽ w5FNQMBUFNFUIPEͩͱௐཧํ๏ͷΫϥεΛϨγϐ͚ͩมߋ͕ೖΔ w͔͠͠ɼ'BDUPSZͩͱͨͩαϒΫϥεͰมߋΛՃ͑ΔͷΈʂ 'BDUPSZ.FUIPEΛձಘͨ͠ྉཧਓ $PPLQBEҎ֎ϨγϐݟΕΔΑ͏ʹͳͬͨΑ
w'BDUPSZ.FUIPEɼ5FNQMBUF.FUIPEͱҧͬͯɼαϒδΣΫτͷੜαϒΫ ϥεʹͤΔΑ͏ʹ͢Δɽ wαϒΫϥε͕ΦϒδΣΫτΛੜ͢ΔͷͰɼαϒΫϥεʹࣗ༝͕૿ͯ͠৭ʑͰ ͖ΔΑ͏ʹͳΔɽ w"CTUSBDU'BDUPSZ'BDUPSZ.FUIPEΛͬͱநతʹͨ͠ͷʁ ·ͱΊ 'BDUPSZ.FUIPEʹࣗ༝Λ
More Decks by mei28
See All by mei28
[Human-AI Decision Making勉強会] 利用者の判断基準に合わせた説明は人の意思決定を誘導するか
mei28
0
90
[FAccT'26] Do User-Aligned Explanations Steer Human Decisions? Context-Dependent Influence and Ethical Implications
mei28
0
120
[Human-AI Decision Making勉強会] 説明を部分的に見せることで人に考えさせ、AIへの不適切な依存を減らす
mei28
0
180
[読み会] CHI2025論文紹介
mei28
1
140
[読み会] “Are You Really Sure?” Understanding the Effects of Human Self-Confidence Calibration in AI-Assisted Decision Making
mei28
0
200
[JSAI'24] 人間の判断根拠は文脈によって異なるのか?〜信頼されるXAIに向けた人間の判断根拠理解〜
mei28
2
990
[CHI'24] Fair Machine Guidance to Enhance Fair Decision Making in Biased People
mei28
0
160
[DEIM2024] 卓球の得点予測における重要要素の分析
mei28
0
89
[Human-AI Decision Making勉強会] 意思決定 with AIは個人vsグループで変わるの?
mei28
0
290
Featured
See All Featured
Build your cross-platform service in a week with App Engine
jlugia
234
19k
Paper Plane (Part 1)
katiecoart
PRO
3
12k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
1
300
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
4
1.3k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
1k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
3.1k
Balancing Empowerment & Direction
lara
6
1.4k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.3k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
580
It's Worth the Effort
3n
188
29k
My Coaching Mixtape
mlcsv
0
390