Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
[作成途中]Unity設計勉強会 ポリモーフィズム編 / Unity Architecture...
Search
Ryo Yamamoto
September 05, 2019
Programming
0
49
[作成途中]Unity設計勉強会 ポリモーフィズム編 / Unity Architecture Polymophism
Ryo Yamamoto
September 05, 2019
Tweet
Share
More Decks by Ryo Yamamoto
See All by Ryo Yamamoto
Unity設計勉強会 単一責任原則編 / Unity Architecture SRP
ryo24
0
68
3 Education Topics For LightningTalk
ryo24
1
29
Presentationに流れを作ろう
ryo24
1
66
定期発表会スライドアドバイス
ryo24
0
53
ライトニングトークレベルアップ講座
ryo24
1
120
Other Decks in Programming
See All in Programming
はじめてのDSPy - 言語モデルを『プロンプト』ではなく『プログラミング』するための仕組み
masahiro_nishimi
3
3.4k
TransformerからMCPまで(現代AIを理解するための羅針盤)
mickey_kubo
3
870
登壇は dynamic! な営みである / speech is dynamic
da1chi
0
350
CSC509 Lecture 05
javiergs
PRO
0
310
Claude CodeによるAI駆動開発の実践 〜そこから見えてきたこれからのプログラミング〜
iriikeita
0
310
ソフトウェア設計の実践的な考え方
masuda220
PRO
4
630
What's new in Spring Modulith?
olivergierke
1
160
XP, Testing and ninja testing ZOZ5
m_seki
3
790
CSC305 Lecture 10
javiergs
PRO
0
220
フロントエンド開発のためのブラウザ組み込みAI入門
masashi
6
3.3k
iOSでSVG画像を扱う
kishikawakatsumi
0
150
NixOS + Kubernetesで構築する自宅サーバーのすべて
ichi_h3
0
1.1k
Featured
See All Featured
Speed Design
sergeychernyshev
32
1.2k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.5k
4 Signs Your Business is Dying
shpigford
185
22k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
37
2.6k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
10
610
Being A Developer After 40
akosma
91
590k
The Pragmatic Product Professional
lauravandoore
36
7k
Gamification - CAS2011
davidbonilla
81
5.5k
Unsuck your backbone
ammeep
671
58k
How to Think Like a Performance Engineer
csswizardry
27
2.1k
Making the Leap to Tech Lead
cromwellryan
135
9.6k
Transcript
Date : 09/05 Time : 15:00~ Place: LiT! Osaka S.O.L.I.D
Object Oriented Design Thurs 09/05
None
ಜεΫϦϓτ Ͱͷศརͳૢ࡞ ํ๏
1PMZNPQIJTN Λ͍͜ͳ͢ʂ
S.O.L.I.D.
40-*%ݪଇ ɾ4ɿ୯Ұͷݪଇ ɾ0ɿ։์ดͷݪଇ ɾ-ɿϦείϑͷஔݪଇ ɾ*ɿΠϯλʔϑΣΠεͷݪଇ ɾ%ɿґଘੑٯసͷݪଇ
جఈΫϥεੜΫϥεͱ ަՄೳͰͳ͚ΕͳΒͳ͍ ݪଇ Ϧείϑͷஔ๏ଇ
ʁʁʁʁ
ΦϒδΣΫτ ࢦ
ؔͱมΛ ·ͱΊΔ
ܧঝͱҕৡ Ϋϥε Πϯλʔ ϑΣΠε
None
ɾΧϓηϧԽ ɹ֎෦Ϋϥε͔Β࣮ΛӅṭ͢Δ ɹˠ$ϓϩύςΟ͕ศར ɾϙϦϞʔϑΟζϜ ɹಉ໋͡ྩͰҟͳΔΦϒδΣΫτ ɹΛૢ࡞͢Δ 001ͷେཁૉ
ΧϓηϧԽ
Class Human{ public string name; public int age; } Class
Game{ Human alex = new Human(); alex.name = “Alex”; alex.age = 22; } Human bob = new Human(); alex.name = “Bob”; alex.age = -20;
ਓؒؒҧ͑Δ ͜ͱ͋Δ
BHFΛ֎͔Β ݟ͑ͳ͍Α͏ ʹ͢Δ
Class Human{ private string name; private int age; public int
GetAge(){ return age; } public void SetAge(int input){ if(input > 0){ age = input; }else{ age = 99; } }
ϑΟʔϧυQSJWBUF ϝιουQVCMJD
(FUUFS 4FUUFS
Class Human{ //লུ } Class Game{ Human alex = new
Human(); alex.SetName(“Alex”); alex.SetAge(22); Debug.Log(“Alex age: ” + alex.getAge()); }
ຖճ࡞Δͷ ͩΔ͘ͳ͍ʁ
ຖճϝιουͳͷ ͩΔ͘ͳ͍ʁ
ͦͦ ྸϑΟʔϧυ ͱͯ͠ར༻͍ͨ͠
$ ศརͳΜͰ͢
ͦΜͳػೳ͕ ͋Γ·͢
֎෦͔Βʮมʯʹݟ͑ͯ ෦͔Βʮؔʯʹݟ͑Δ ϓϩύςΟ $ͱͯ͠ͷػೳ
Class Human{ private string name; private int age; public int
GetAge(){ return age; } public void SetAge(int input){ if(input > 0){ age = input; }else{ age = 99; } }
Class Human{ private int _age; public string Name{get; set;}; public
int Age{ get{ return _age; } set{ _age = value > 0 ? value : 99; } } }
Class Human{ //লུ } Class Game{ Human alex = new
Human(); alex.SetName(“Alex”); alex.SetAge(22); Debug.Log(“Alex age: ” + alex.getAge()); }
Class Human{ //লུ } Class Game{ Human alex = new
Human(); alex.Name = “Alex”; alex.Age = 22; Debug.Log(“Alex age: ” + alex.Age); }
͖ͬ͢Γ
(BNFΫϥε "HFͷ࣮Λ ؾʹ͠ͳ͍͍ͯ͘
ΧϓηϧԽ
ϙϦϞʔ ϑΟζϜ
)VNBOΛϕʔε ʹϝϯλʔͱϝϯ όʔΛ࡞Ζ͏
)VNBOΫϥεΛ ܧঝͨ͠ϝϯλʔ Ϋϥεͱϝϯόʔ ΫϥεΛ࡞Ζ͏
Class Human{ //লུ public string Name{get; set;}; public int Age{get;
set;}; } Class Mentor: Human{ public string Area{get; set;}; public int LdCourse{get; set;}; } Class Member: Human{ public string UsingServce{get; set} public int Course{get; set;}; }
Class Game{ Human alex = new Human(); alex.Name = “Alex”;
alex.Age = 22; Mentor candy = new Mentor(); candy.Name = “Candy”; candy.Age = 22; candy.Area = “Kansai”; candy.LdCource = 3; //Unityͷ͜ͱ }
ϝϯόʔ͋Δ͋Δ ࣈͰछྨΛද͢
FOVN ͑ΔΑʁ
ಛఆͷछྨΛ·ͱΊͯදݱ ࣈʹҙຯΛͨͤΔ͜ͱ્ࢭ จࣈྻͷଧͪؒҧ્͑ࢭ FOVNྻڍܕ ࣮ଶJOUσʔλ
public enum litCourse{ iPhone, Android, Unity, WebDesign, WebService } Class
Mentor: Human{ private litCourse _course; public litCourse LdCourse{get; set;} }
Class Game{ Human alex = new Human(); alex.Name = “Alex”;
alex.Age = 22; Mentor candy = new Mentor(); candy.Name = “Candy”; candy.Age = 22; candy.Area = “Kansai”; candy.LdCource = litCourse.Unity; }
͔͜͜Βຊ
͜͜Ͱ ྫʹઓʂ
ʂ ɾγϡʔςΟϯάήʔϜΛ࡞Ζ͏ʂ ʻબϘλϯʼ ɾఢछྨ ɾยํͰ྆ํಉ࣌Ͱબ0, ɾબ࣌ͦͷݩૉͷબ͕ ɹ͔ΔΑ͏ʹ͢Δ ɹʢςΩετ͕ଟҰ൪ૣ͍ͱࢥ͍·͢ʣ ʻܾఆϘλϯʼ ɾςΩετʹબΕͨݩૉΛදࣔ͢Δ
ϝϯλʔ ϝϯόʔ ʹಉ࣌ʹ ͓ئ͍͍ͨ͠
Class Human{ //লུ public string Name{get; set;}; public int Age{get;
set;}; public int Enegy{get; set;}; //Eat Something public void Eat(){ } }
Class Mentor: Human{ public void Eat(){ food.EatRedbull(); Enegy += 20;
} } Class Member: Human{ public void Eat(){ food.EatHumburger(); Enegy += 8; } }
Class Game{ Human alex = new Human(); Mentor candy =
new Mentor(); Member drake = new Member(); alex.Eat(); drake.Eat(); }
૿͑ͨΒ Ͳ͏͢Δͷʁʁ
Class Game{ Human alex = new Human(); Mentor candy =
new Mentor(); Member drake = new Member(); Mentor elisa = new Mentor(); alex.Eat(); drake.Eat(); elisa.Eat(); }
-JTU5ͱ GPSFBDI ͍͍ͨʂ
Class Game{ Human alex = new Human(); Mentor candy =
new Mentor(); Member drake = new Member(); Mentor elisa = new Mentor(); List<Mentor> mentorList = new List<Mentor>; mentorList.add(drake); }
ϝϯόʔͱϝϯλʔΛ ಉ࣌ʹѻ͍͍ͨ
ࢠΫϥεͷมʢΠϯελϯεʣ ΫϥεͷܕʹೖՄೳ ϙϦϞʔϑΟζϜͷϙΠϯτ ܕΛ߹ΘͤΒΕΔ
ϙϦϞʔϑΟζϜͷϙΠϯτ ਓؒ ϝϯλʔ ϝϯόʔ খΫϥεඞͣΫϥεͷଐੑΛ͍࣋ͬͯΔͨΊ
Class Game{ Human alex = new Human(); Human candy =
new Mentor(); Human drake = new Member(); Human elisa = new Mentor(); List<Human> mentorList = new List<Human>; mentorList.add(drake); }
Class Game{ //alex͔Βelisa·ͰΛ࡞ͬͨ List<Human> mentorList = new List<Human>; mentorList.add(alex); //ਓؒ
mentorList.add(bob); mentorList.add(candy); //ϝϯλʔ mentorList.add(drake); //ϝϯόʔ }
Class Human{ //লུ public string Name{get; set;}; public int Age{get;
set;}; public int Enegy{get; set;}; //Eat Something public virtual void Eat(){ } }
abstract Class Human{ //লུ public string Name{get; set;}; public int
Age{get; set;}; public int Enegy{get; set;}; //Eat Something public abstract void Eat(); }
Class Mentor: Human{ public override void Eat(){ food.EatRedbull(); Enegy +=
20; } } Class Member: Human{ public override void Eat(){ food.EatHumburger(); Enegy += 8; } }
՝
࣭
ײ