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
50
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
100
[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
190
[読み会] 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
1k
[CHI'24] Fair Machine Guidance to Enhance Fair Decision Making in Biased People
mei28
0
170
[DEIM2024] 卓球の得点予測における重要要素の分析
mei28
0
90
[Human-AI Decision Making勉強会] 意思決定 with AIは個人vsグループで変わるの?
mei28
0
290
Featured
See All Featured
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
68
61k
How STYLIGHT went responsive
nonsquared
100
6.4k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
580
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
850
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
880
A Modern Web Designer's Workflow
chriscoyier
699
190k
Code Reviewing Like a Champion
maltzj
529
40k
Well, that’s weird…
csswizardry
1
210
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
56
3.5k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
1
630