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
リファクタリングとtsort
Search
ainame
October 16, 2013
Programming
1
1.7k
リファクタリングとtsort
`ib` gemをリファクタリングして、機能追加した時の話
ainame
October 16, 2013
Tweet
Share
More Decks by ainame
See All by ainame
Swift 5.7で変わる正規表現を試してみよう
ainame
4
5.8k
iOSDC 2021 - App Store用スクリーンショットの自動生成をアラビア語対応してSwiftUIで実装してみた
ainame
0
5.5k
DNN/GPU with Ruby #rubykaigi
ainame
2
3k
Server Side Swift実用性評価 2017 #iosdc #b
ainame
3
4.3k
Process tons of jobs with Swift
ainame
0
1.7k
Swift on the ObjC #shibuyaswift
ainame
4
800
家族アルバムみてね 開発風景 #realm_jp
ainame
4
4k
iOSで無限バックグラウンドアップロード(に挑戦してみた話)
ainame
2
4.7k
RubyMotionについて #mixiwwdc
ainame
2
400
Other Decks in Programming
See All in Programming
flutterkaigi_2024.pdf
kyoheig3
0
140
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
120
みんなでプロポーザルを書いてみた
yuriko1211
0
260
CSC509 Lecture 11
javiergs
PRO
0
180
Nurturing OpenJDK distribution: Eclipse Temurin Success History and plan
ivargrimstad
0
940
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
1
100
Jakarta EE meets AI
ivargrimstad
0
580
cmp.Or に感動した
otakakot
3
200
RubyLSPのマルチバイト文字対応
notfounds
0
120
リアーキテクチャxDDD 1年間の取り組みと進化
hsawaji
1
220
Contemporary Test Cases
maaretp
0
140
CSC509 Lecture 12
javiergs
PRO
0
160
Featured
See All Featured
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
28
2k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
8
890
Building Your Own Lightsaber
phodgson
103
6.1k
Writing Fast Ruby
sferik
627
61k
Producing Creativity
orderedlist
PRO
341
39k
Navigating Team Friction
lara
183
14k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
The Invisible Side of Design
smashingmag
298
50k
Ruby is Unlike a Banana
tanoku
97
11k
Transcript
ϦϑΝΫλϦϯάͱtsort 2013-10-16 / Shibuya.rb @ainame
ࣗݾհ @ainame / Satoshi Namai גࣜձࣾϛΫγΟ εϚϗΞϓϦΤϯδχΞʹͳΔ༧ఆͩͬͨͷͰ͢ ͕ɺ૬มΘΒͣPerlॻ͍ͯ·͢ ࠷ۙɺRubyMotionͬͯΔ ͘͘ձ
/ RubyMotion Tokyo meetups
ࠓͷ 1.ϦϑΝΫλ1 - ςϯϓϨʔτΤϯδϯಋೖ 2.ϦϑΝΫλ2 - Hash & ArrayΛΦϒδΣΫτԽ 3.tsortಋೖͰػೳվળ
gemΛ͍ͬͨ͡
None
None
ibʹ͍ͭͯ RubyMotionͰInterfaceBuilderΛ͏ͨΊͷgem rake ib:open app/*.rbΛparseͯ͠Stubs.hΛు͘ Interface Builder্ͰOutletΛUIͱ࿈ܞͰ͖Δ https://github.com/yury/ib
ib͕Ruby͔Βੜ
super class͕ઌʹఆٛ ͞Εͯͳ͍ͱμϝ Τϥʔ͕ग़Δͷ ݏͩͬͨ
Կͱͳ͍ͨ͘͠ͳʔ ͱࢥͬͯιʔείʔυಡΜͰΈͨΒ खΛೖΕΔͷ͕ਏͦ͏ͩͬͨͷͰ ϦϑΝΫλϦϯάͯ͠Έͨ
templateΤϯδϯͷಋೖ Stubs.hΛग़ྗ͢ΔͨΊʹίʔυͷதʹͻͳܗίʔ υ͕ຒΊࠐ·Ε͍ͯͨ 1ຕϑΝΠϧΛςϯϓϨʔτϑΝΠϧɺςϯϓϨʔ τͷhelperɺϑΝΠϧੜॲཧͷ3ͭʹ `tilt` gemཱ͕ͭ SinatraͰΘΕͯΔ
Before
writeϝιουʹ ॲཧ͕ϕλॻ͖ ඞͣIOॲཧ͕ൃੜͯ͠ ςετͮ͠Β͍
ϔϧύʔͷ தͰϔϧύʔ͕ݺΕͯ ॲཧ͕͍ͮΒ͍ ྻΞΫηε ͕Ή͍ͣ
After
tiltͰrender͢Δॲཧ RenderingHelperΫϥεʹ viewͷϔϧύʔΛ࣮ ϔομͱ ࣮ϑΝΠϧΛ ϑΝΠϧʹॻ͖ग़͠
͜ͷޙ հ͢ΔϦϑΝΫλϦϯάͰ ϔϧύʔγϯϓϧʹ
Hash & ArrayΛΦϒδΣΫτԽ HashͱArrayͰԿͰσʔλΛදݱ͍ͯ͘͠ͷ͏Μ͟Γ͢Δ data[‘a.rb’][0][:class][0][0] ????????? ڞಉ։ൃ͢Δ࣌ʹۤ͠Ή σʔλΛϥοϓ͢ΔΦϒδΣΫτΛ࣮ def [](key);
@data[key] endͰޓΛ࣋ͨͤΔ ΞΫηαʔΛ༻ҙͯ͠ෳࡶͳΞΫηεΛղܾ
Before
None
After
None
ߏମͰ͞Βʹ ߏԽ ϔϧύʔ ݩσʔλʹΞΫηεग़དྷΔ
ݩͷinfo[:class][0][0] ΑΓ͔Γ͍͢
ґଘؔղܾ Կߟ͑ͣʹϔομʔϑΝΠϧʹॻ͖ͩ͢ͱ XCode্ͰΤϥʔˍwarn͕ग़Δ ্͔Βॱʹ͖ͪΜͱΫϥεఆٛ͞Εͯͳ͍ͱμϝ ґଘؔͷղܾ͕ඞཁʂʂʂʂʂʂʂ tsort͏ͱ͕؆୯ʹղ͚Δʂ
super class͕ઌʹఆٛ ͞Εͯͳ͍ͱμϝ
tsort tsortͱʁ Rubyͷඪ४ϥΠϒϥϦ τϙϩδΧϧιʔτͷRubyͷ࣮ ґଘؔͷղܾʹ͑Δ rubygems, bundlerͱ͔ʹΘΕͯΔ
τϙϩδΧϧιʔτ ༗ແด࿏άϥϑ άϥϑͷؒͷґଘؔΛݩͱʹιʔτ͢Δ ӈͷਤͷ߹ B, A, D, C, Eͷॱ
IB::DependencyResolver ґଘؔղܾ༻ͷΫϥεΛ࣮ parse݁ՌΛड͚औΔ ༗ແด࿏άϥϑʹม tsortͰฒͼସ͑ ฒͼସ͑݁ՌΛฦ͢
Τϥʔ 0 !!!
·ͱΊ طଘgemʹػೳՃ͢Δ࣌ʹ͙͢ʹػೳՃ͕ແ ཧͦ͏ͩͬͨΒগͮͭ͠ϦϑΝΫλϦϯά ύʔϑΣΫτRubyʹࡌͬͯͳ͍͚Ͳɺ tsortͱ͔tiltͱ͔ศརͳͷͰϢʔςΟϦςΟܥͷ ϥΠϒϥϦ࡞Δ͍࣌·͠ΐ͏ʂʂʂ
RubyMotion meetup •@ainameͱ@HIROCASTER͕ओ࠵ •ຖ݄ͷୈೋՐ༵ʹ։࠵Ͱ͘͘ձελΠϧ •RubyMotion։ൃऀͷ@watson1978͞ΜࢀՃ •ձϛΫγΟͷίϥϘϧʔϜ •࣍ճ201311݄5(Ր)Ͱ͢