Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
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
69
3 Education Topics For LightningTalk
ryo24
1
29
Presentationに流れを作ろう
ryo24
1
67
定期発表会スライドアドバイス
ryo24
0
53
ライトニングトークレベルアップ講座
ryo24
1
120
Other Decks in Programming
See All in Programming
マスタデータ問題、マイクロサービスでどう解くか
kts
0
110
宅宅自以為的浪漫:跟 AI 一起為自己辦的研討會寫一個售票系統
eddie
0
510
Deno Tunnel を使ってみた話
kamekyame
0
150
20251212 AI 時代的 Legacy Code 營救術 2025 WebConf
mouson
0
190
C-Shared Buildで突破するAI Agent バックテストの壁
po3rin
0
400
WebRTC、 綺麗に見るか滑らかに見るか
sublimer
1
190
ハイパーメディア駆動アプリケーションとIslandアーキテクチャ: htmxによるWebアプリケーション開発と動的UIの局所的適用
nowaki28
0
430
FluorTracer / RayTracingCamp11
kugimasa
0
240
안드로이드 9년차 개발자, 프론트엔드 주니어로 커리어 리셋하기
maryang
1
120
dotfiles 式年遷宮 令和最新版
masawada
1
790
Context is King? 〜Verifiability時代とコンテキスト設計 / Beyond "Context is King"
rkaga
10
1.3k
ViewファーストなRailsアプリ開発のたのしさ
sugiwe
0
500
Featured
See All Featured
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
22
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
1.8k
Prompt Engineering for Job Search
mfonobong
0
110
Building the Perfect Custom Keyboard
takai
1
660
KATA
mclloyd
PRO
33
15k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Fireside Chat
paigeccino
41
3.7k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
1
860
jQuery: Nuts, Bolts and Bling
dougneiner
65
8.3k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.6k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
710
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
63
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; } }
՝
࣭
ײ