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
44
[作成途中]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
64
3 Education Topics For LightningTalk
ryo24
1
28
Presentationに流れを作ろう
ryo24
1
65
定期発表会スライドアドバイス
ryo24
0
51
ライトニングトークレベルアップ講座
ryo24
1
110
Other Decks in Programming
See All in Programming
LINEヤフー データグループ紹介
lycorp_recruit_jp
0
1.6k
ペアプロ × 生成AI 現場での実践と課題について / generative-ai-in-pair-programming
codmoninc
0
160
ReadMoreTextView
fornewid
1
490
LT 2025-06-30: プロダクトエンジニアの役割
yamamotok
0
640
『自分のデータだけ見せたい!』を叶える──Laravel × Casbin で複雑権限をスッキリ解きほぐす 25 分
akitotsukahara
1
590
Benchmark
sysong
0
280
VS Code Update for GitHub Copilot
74th
1
490
AIコーディング道場勉強会#2 君(エンジニア)たちはどう生きるか
misakiotb
1
270
Railsアプリケーションと パフォーマンスチューニング ー 秒間5万リクエストの モバイルオーダーシステムを支える事例 ー Rubyセミナー 大阪
falcon8823
4
1k
RailsGirls IZUMO スポンサーLT
16bitidol
0
110
Java on Azure で LangGraph!
kohei3110
0
170
データの民主化を支える、透明性のあるデータ利活用への挑戦 2025-06-25 Database Engineering Meetup#7
y_ken
0
330
Featured
See All Featured
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.3k
The Cult of Friendly URLs
andyhume
79
6.5k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
5
230
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
657
60k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
32
2.4k
KATA
mclloyd
30
14k
Side Projects
sachag
455
42k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
8
680
The World Runs on Bad Software
bkeepers
PRO
69
11k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
17
950
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
StorybookのUI Testing Handbookを読んだ
zakiyama
30
5.8k
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; } }
՝
࣭
ײ