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
Rubyistなら知っておきたい継承の話 / The inheritance for Rubyist
Search
Hiroyuki Morita
July 29, 2018
4
1.4k
Rubyistなら知っておきたい継承の話 / The inheritance for Rubyist
TokyuRuby会議 12
Hiroyuki Morita
July 29, 2018
Tweet
Share
More Decks by Hiroyuki Morita
See All by Hiroyuki Morita
esaを使って暗黙知を減らす取り組み
chiastolite
2
4.1k
git-inside
chiastolite
0
250
vagrant-itamae
chiastolite
1
1.5k
sushi for common people
chiastolite
0
330
Social Coding with GitHub
chiastolite
0
140
Low Level Git
chiastolite
0
94
about Immutable Infrastructure
chiastolite
0
86
Featured
See All Featured
Build your cross-platform service in a week with App Engine
jlugia
229
18k
How to Think Like a Performance Engineer
csswizardry
22
1.3k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
Visualization
eitanlees
146
15k
Intergalactic Javascript Robots from Outer Space
tanoku
270
27k
Building Better People: How to give real-time feedback that sticks.
wjessup
366
19k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
33
2k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.2k
Scaling GitHub
holman
459
140k
Gamification - CAS2011
davidbonilla
80
5.1k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
Transcript
RubyistͳΒͬͯ ͓͖͍ͨ ܧঝͷ 2018/07/29 TokyuRubyձٞ12 @chiastolite as cͳΜͱ͔e a.k.a ཧແ৬
a.k.a അձһূ
ܧঝͱ?
ܧঝ class Parent # Ϋϥε end class Child < Parent
# ࢠΫϥε end
͔ΒࢠʹҾ͖ܧ͕ΕΔͷʁ
! ! ῡ
Ҩ࢈૬ଓ
Ҩ࢈૬ଓͷجຊ 1. ඃ૬ଓਓͷࡒ࢈ͷࡧ 2. ඃ૬ଓਓͷࡒ࢈ͷׂΛڠٞ 3. (ඞཁͰ͋Ε) ૬ೲ੫ͷೲ
૬ଓ੫ͷਃࠂ
૬ଓ੫ͷਃࠂɾೲ10ϲ݄Ҏ begin start = Time.now if ਃࠂ͕ඞཁ? ਃࠂ ೲ੫ raise
'ظݶΦʔόʔ' if Time.now > start + 10.months end rescue ೲ੫ֹ + ແਃࠂՃࢉ੫ + Ԇ੫ end
ਃࠂͷఆ? جૅ߇আ = 30_000_000 def ਃࠂ͕ඞཁ? ૬ଓֹ > جૅ߇আ +
૬ଓਓ * 6_000_000 end def ૬ଓֹ amount ||= 0 amount += parent.ݱۚ amount += parent.༬ஷۚ amount += parent.ূ݊ amount += parent. amount += parent.ݐ amount += parent.ࣗಈं amount -= parent.࠴ end
૬ଓ੫ͷઅ੫
૬ଓֹΛઅ੫͢Δʹ → ੜલଃ༩ → ॅΒڭҭΒͷࢧԉΛͯ͠Β͏ → ͳͲΛങ͏ͱࢿ࢈ֹ͕ 㽊 → ඇ՝੫ͷࢿ࢈Λങ͏
→ ಛྫΛ͏ →খنͷಛྫ
ͦΕͰӽ͑ͯ͠·ͬͨΒʁ
͖͋ΒΊ·͠ΐ͏ɻਃࠂͩʂ
୭ʹཔΉʁ → ۜߦ → หޢ࢜ → ੫ཧ࢜ → ࢘๏ॻ࢜ →
ߦॻ࢜ ͩΕʹཔΊ͍͍ͷΒ…
!
͜ͷࡍɺࣗͰͬͯ͠·͍͍͑ͷʁ
ͱ͍͏Θ͚ͰͬͯΈͨ → ܭࢉͱ͔هೖྫ͕ͪΌΜͱ͋ΔͷͰ؆୯ → Ձ͕໌֬ͳݱۚ࠷ߴ
ਃࠂͷ໘ͳͱ͜Ζ → खॻ͖ॻྨ࠷ѱ →هೖϛεڐ͞Εͳ͍… → ඃ૬ଓਓͷੜ·Ε͔ͯΒͷށ੶౽ຊूΊ → ਃࠂઌʮඃ૬ଓਓʯͷ࠷ऴډॅ → Ͳ͜ʹݴͬͯʮ͓͑Ͱ͖ͳ͍ʯ
·͍͊Ζ͍Ζ͋Γ·͕ͨ͠
ͳΜͱ͔ͳΔͷ
࠷ޙʹ
ࣄલͷใେࣄ → ށ੶Ͳ͜ʹ͋Γͦ͏ʁ → Ͳͷۚ༥ػؔͬͯΔʁ → ӅΕͨࢿ࢈ͳ͍ʁ
Λฉ͔͕ͤͯΒͦΜͳΛͯ͠Έͯ?