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
A Practitioner's Journey from Ruby 1.8 to Present
Search
Koichi ITO
September 09, 2023
Programming
1
2k
A Practitioner's Journey from Ruby 1.8 to Present
大阪Ruby会議03 (
https://regional.rubykaigi.org/osaka03/
)
Koichi ITO
September 09, 2023
Tweet
Share
More Decks by Koichi ITO
See All by Koichi ITO
Carving the Way to Ruby Engineering
koic
3
440
Beyond the RuboCop Defaults
koic
3
3k
Minify Ruby Code
koic
2
2.2k
Permanent Agility
koic
37
7.7k
RuboCop: LSP and Prism
koic
3
4.2k
Organizational Pattern Hatching
koic
0
1.5k
A Story Featuring Right Hand Archetype
koic
0
1.1k
Without Practice, No Emergence
koic
4
2.4k
The Resurrection of the Fast Parallel Test Runner
koic
1
6.2k
Other Decks in Programming
See All in Programming
Discord Bot with AI -for English learners-
xin9le
1
120
Security_for_introducing_eBPF
kentatada
0
110
わたしの星のままで一番星になる ~ 出産を機にSIerからEC事業会社に転職した話 ~
kimura_m_29
0
180
rails stats で紐解く ANDPAD のイマを支える技術たち
andpad
1
290
StarlingMonkeyを触ってみた話 - 2024冬
syumai
3
270
なまけものオバケたち -PHP 8.4 に入った新機能の紹介-
tanakahisateru
1
120
Go の GC の不得意な部分を克服したい
taiyow
2
760
短期間での新規プロダクト開発における「コスパの良い」Goのテスト戦略」 / kamakura.go
n3xem
2
160
Recoilを剥がしている話
kirik
5
6.6k
14 Years of iOS: Lessons and Key Points
seyfoyun
1
770
Monixと常駐プログラムの勘どころ / Scalaわいわい勉強会 #4
stoneream
0
270
バグを見つけた?それAppleに直してもらおう!
uetyo
0
170
Featured
See All Featured
A Modern Web Designer's Workflow
chriscoyier
693
190k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Building a Scalable Design System with Sketch
lauravandoore
460
33k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Bash Introduction
62gerente
608
210k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
59k
How GitHub (no longer) Works
holman
311
140k
Adopting Sorbet at Scale
ufuk
73
9.1k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
Done Done
chrislema
181
16k
Transcript
,PJDIJ*50&4. *OD A Practitioner's Journey from Ruby 1.8 to Present
Have you been able to craft your job to be fun? େࡕ3VCZձٞ 4BU ϋʔτϯϗςϧ৺ࡈڮদ෩ϗʔϧ
@koic w044ϓϩάϥϚʔ w3VCP$PQίΞνʔϜ wגࣜձࣾӬγεςϜϚωδϝϯτ &4. *OD ΤϯδχΞϦϯάϚωʔδϟʔ݉ σΟεςΟϯάΠογϡυΤϯδχΞ
w ʰΦϒδΣΫτࢦεΫϦϓτݴޠ3VCZʱ ͕ڭຊɻʰσεΫτοϓϦϑΝϨϯεʱΛ ࣋ͪา͍ͯ௨ۈͯͨ͠ɻ 3VCZͱࢲ
None
େࡕ3VCZձٞͷ&4.ϝϯόʔ 4 Q FBLFS @junk0612 4 Q FBLFS @koic -5
@maimux2x 4 UB f @haruguchiyuma " UUFOEFF @fugakkbn " UUFOEFF @nsgc " UUFOEFF @kakutani ϑΣϩʔ
w ຊ3VCZΧϯϑΝϨϯε͔Βࠓͷ 3VCZ,BJHJ·Ͱͯ͢εϙϯαʔͯ͠Δ ੈք།Ұͷاۀ ެืͷͳ͍ আ͘ w 3VCZ,BJHJ
-5 -5 ొஃഐग़ w ຊࠃͰ34QFDͱ)BNMॳظͷಋೖاۀ 3VCZͱ&4. *OD
044ίϛϡχςΟͱͷڞੜΛࢧԉ 3BJMT044ύονձ #esm_oss
w !KVOL-SBNBίϯτϦϏϡʔλʔ w !4)QBSTFZίϯτϦϏϡʔλʔ w !LPJD1BSTFSHFNίϛολʔ w !JNB[VNJ*3#ίϛολʔ w !GVHBLLCO3#4ίϯτϦϏϡʔλʔ
ߏจղੳثݚڀ෦ IUUQTNBHB[JOFSVCZJTUOFUBSUJDMFT'PMMPX6Q,JSJTIJNB3VCZIUNM /&8
w3VCZͱΞδϟΠϧιϑτ ΣΞ։ൃΛ௨ͯ͡ίϛϡ χςΟͱ͍ͨ͠ਓ wຊશࠃ͔Βઈࢍืूத ΤϯδχΞืूத ͜Εɺωλ͡Όͳ͍Ͱ͔͢ΒͶʁ 🗾
3VCZ͔࣌Βݱࡏͷ࠷৽։ൃ൛Ͱ͋Δ 3VCZ·Ͱɺ3VCZͷόʔδϣϯΞοϓʹ ΑͬͯͲͷΑ͏ͳΠϕϯτ͕͋Γɺ࣌ͷ ࣄͰͷΞϓϦέʔγϣϯ։ൃ͋Δ͍044 ΤίγεςϜͰͲͷΑ͏ͳग़དྷࣄίʔυ ͷมֵ͕͔͋ͬͨԹނ৽Λ͓͠͠·͢ɻ ࠓͷ $'1ఏग़֓ཁΑΓ
ྺ࢙
#FGPSF3BJMT
w ຊ൪ϥϯλΠϜʹ3VCZ͕ೖ͍ͬͯͳ͍ w ։ൃڥͰ͋Ε3VCZΛΠϯείͰ͖Δ w +BWBͩͱෳछͷ+&&αʔόʔʹσϓϩΠ͢Δ &"3ϑΝΠϧͷBQQMJDBUJPOYNMͳΜ͔ͷ αʔόʔݻ༗9.-ଐੑͷฤूΛ3&9.-ͰࣗಈԽ
w 0ODF8SJUF3VO"OZXIFSFͷάϧʔݴޠ🤔 U%JBSZ͕ΩϥʔΞϓϦ࣌
0.(ʹ࠾ʁ !LLE IUUQPCKFDUDMVCKQNMBSDINBHB[JOFIUNM
"GUFS3BJMT
w 3BJMTͱ͍͏ࠇધ͕͖ͬͯͨ w ࣌3BJMTͷ࠾·ͩϦεΫ w 3BJMTొͷ࣌TDB ff PMEͰ·ͱͳΞϓϦ ࡞ΕΔͷٙʁͬͯΈͨΒશવͰ͖ͨ w
࣮ࡍͷͱ͜ΖTDB ff PME͏ػձ͕ͳ͍Α͏ͳ ͓ࣄͰ3VCZΛΩϝΔ࣌
w 3VCZPO3BJMTͰΓΓίʔυΛॻ͚ΔΑ ͏ʹͳͬͨΘΓʹΩϚΓ͗͢ͷΦʔόʔ ϫʔΫʹͳͬͯ͠·ͬͨࣄྫ͋Γ w ࣌ੜ࢈ੑഒͱݴΘΕ͍ͯͨཪ w 3VCZPO3BJMTͰఆ࣌ʹؼΖ͏"8%X3 Ωϝա͗ҙใ͕ग़Δ
w has_manyͳͲͰݴޠ%4-ͷڧྗ͞Λྲྀ w Ҿ࠷ޙͷϋογϡͷϒϨʔεͷলུͰ ΩʔϫʔυҾͬΆ͞ ࣌=>ه๏ͷΈ w 3BJMTͰಋೖ͞ΕͨSymbol#to_proc͕3VCZ
ʹϙʔςΟϯά͞ΕΔ 3BJMTʹΑΔ3VCZͷදݱྗ
͡·ΓͷSymbol#to_proc https://github.com/rails/rails/commit/69bf71f5e9b537f88acc0d4492a057336e7305d1
.FSHF:"37
w :"37͕ೖͬͯɺ"45ϕʔεͷධՁث͔ Β7.ʹΑΔόΠτίʔυ࣮ߦʹͳͬͨ w άϦʔϯεϨου͔ΒωΠςΟϒεϨουʹ ͳͬͨ (7-͕͋Δͷͷ*0ͪͳͲͷϒ ϩοΫதଞͷεϨου͕࣮ߦͰ͖Δ w
ͭ·ΓΞοϓάϨʔυ͢Δͱ͘ͳΔ࣌ ΞϓϦίʔυԼͰͷมԽ
w key => valueʹՃ͑key: valueͷ)BTIه๏ಋೖ w ྩ ࣌3VCZEFW ʹ
ʮ3VCZͷ)BTIه๏ʯͱίϝϯτ͢Δ͜ͱ͕ʂ w ΩʔϫʔυҾ͕ೖͬͨͷ3VCZ͔Β͕ͩɺϝιο υҾͷ࠷ޙͷϋογϡ͕ຊʹͦΕͬΆ͘ w ࣌ࢍ൱྆ͷlambdaͷ->ه๏͕ೖͬͨ w จࣈͱه߸ͷࣝผௐ͕ઈົ ΞϓϦίʔυ͕ݱతͳݟͨʹ
w 3VCZҎલͷจࣈྻόΠτͷγʔέϯε w ⤴Ͱଟ͘ͷEncoding::CompatibilityErrorͱରቂ w # encoding: UTF-8ϚδοΫίϝϯτʹΑΔ εΫϦϓτΤϯίʔσΟϯάͷࢦఆͱ
String#force_encodingͳͲʹΑΔετϦʔϜ ΤϯίʔσΟϯάมͰΓͬͨΑ͏ͳ w ͓͔͛ͰͷΞοϓάϨʔυ͘͠ͳ͔ͬͨʁ ΞϓϦίʔυͷඇޓ աڈ࠷େ
5IF'JSTU4UBCMF
w 3VCZ(FNT͕ඪ४ఴʹͳΔ w ruby setup.rbίϚϯυʹΑΔΠϯετʔϧ apt-get install railsͱ͍͏gemཧͱࠞ ͥΔͳةݥͷ౫ଡ
w ͜ͷޙ͘Β͍ʹ3BJMTʹ#VOEMFS͕౷߹͞Εͯ ύοέʔδཧͷΤίγεςϜ͕҆ఆͨ͠ ܥ࠷ॳͷ҆ఆόʔδϣϯ
.BOZ/FX'FBUVSFT
w ΩʔϫʔυҾɺModule#prependɺ γϯϘϧϦςϥϧɺEnumerable#lazyɺ َӢɺTracePointɺ3F fi OFNFOUTͳͲͳͲ w ӽ͠ͷΞοϓάϨʔυͰຊʹ৽ػೳ
Γͩ͘͞Μͩͬͨ w ϝλϓϩΪϟϯάେتͼʁ ޫͷػೳͱҋͷػೳͨ͘͞Μ
w εΫϦϓτΤϯίʔσΟϯάͷσϑΥϧτ͕ 65'ʹͳͬͨ ࠓϚδίϝෆཁ εΫϦϓτΤϯίʔσΟϯάෆཁ
*NQSPWFNFOUT
w ΞϓϦ໘Ͱେ͖ͳมߋࢥ͍ग़ͤͳ͍ վળʹײँ
4ZNCPM($
w 3BJMTͰ4ZNCPM($ඞਢͷͨΊಋೖ ͞Εͨ3VCZҎ্Λཁٻ͢Δ w ݫີʹόάϑΟοΫεͷҎ্͕ཁ݅ վળʹײँ
4FWFSBM6TFGVM4ZOUBYFT
w 4BGF/BWJHBUJPO0QFSBUPS ΅ͬͪԋࢉࢠ ʹΑΔ3BJMTΞϓϦͷtryͱtry!ͷஔ͖͑ w .Ͱेͳ߹ʹ&.Λكʹݟ͔͚Δ 4BGF/BWJHBUJPO0QFSBUPS
w 4RVJHHMZ)FSFEPDʹΑΔ3BJMTΞϓϦͷ strip_heredocͷஔ͖͑ 4RVJHHMZ)FSFEPD
• # frozen_string_literal: trueʹΑ ΔϚδοΫίϝϯτͰfreeze͞Εͨ String͕खʹೖΔΑ͏ʹͳͬͨ • RubyͷॊΒ͔͕͞ݮͬͨʁ w ͕࣌ٞৢ͞Ε͍ͯͨ
GTUSJOHMJUFSBMͷಋೖ
3VCZͰԆظޙͷԻࠫଡʁ https://mametter.hatenablog.com/entry/20151004/p1
3BJMTͱGTUSJOHMJUFSBMT https://github.com/rails/rails/pull/30342
*OUFHFS6OJ fi DBUJPO
ܯࠂͷ͕ྲྀΕΔ w 3VCZͷͱ͖ͱҟͳΓɺ·ͣඇޓͷ ඇਪܯࠂ͞Ε͍ͯͨ w 3VCZEFWΛ͏͜ͱͰϦϦʔε࣌ ʹͷ൙ཞ͕ݮΔΑ͏ʹύονΛૹ͍ͬͯͨ
044ͱৗ w HIR HFNTSD ཧϦϙδτϦ ͷඇਪܯࠂ ύονΛग़͢Τί γεςϜࢀՃͷ ͖͔͚ͬʹͳΔ
*NQSPWFNFOUT
w rescueelseensure͕doend ϒϩοΫʹॻ͚ΔΑ͏ʹͳͬͨͷॻ͖৺ ྑ͍ վળʹײँ
.+*53VCZ7."45
w ͍ͪΜ࣮༻໘ͰӨڹ͍ͯͦ͠͏ w 3VCZΛΠϯετʔϧͨ͠ޙʹ gem i bundlerͱ͍͏ఆܕّྱ͕ෆཁʹ #VOEMFS͕ඪ४ఴ͞ΕΔ
w .+*5͕ಋೖ͞Ε͕ͨɺ3BJMTΞϓϦέʔγϣ ϯͰͷ࣮༻ࣄྫՉฉʹͯ͠ฉ͔ͣͩͬͨ w 3VCZ7."CTUSBDU4ZOUBY5SFFʹΪϟϯά ͕ΞϓϦ֎ͰΓ্͕ΓΛݟ͍ͤͯͨ w ΞϓϦͷ࣮༻໘ͰFOEMFTTSBOHFͳͲͷ ৽ػೳΛ͑ΔΑ͏ʹͳͬͨ
͍Ζ͍Ζͱ࣮ݧతͳ೩ྉԼ
4VQFS)BSE.PEF3VCZ
LXBSHT w ͍͍ͩͨฐࣾͷ ύονձʹग़ͯͨ ਓͷपลͰΤί γεςϜଆͷ LXBSHTͷͷ ରԠΛਐΊ͍ͯͨ ҹ
w OVNCFSFEQBSBNFUFSͷελΠϧੋඇʹͭ ͍ͯʮ3VCZ8FCΛ࡞ΔͨΊͷݴޠͰ ͳ͘εΫϦϓτݴޠʯͱ͍͏ͷͳΔ΄Ͳ w ݸਓతʹอक͢Δίʔυʹ໊લ͕͍ͭͯ ͍ͯΒ͍͍͚ͨΕͲɺॻ͖ࣺͯεϥΠυ ྔΛݮΒ͢ͷʹศར ύλʔϯϚονφϯύϥ
"CTUSBDU*OUFSQSFUBUJPO
CVHTSVCZMBOHPSHJTTVFT 3VCZݴޠʹ͍͔ͳΔܗͰ͋Εܕએݴ ܕऍΛಋೖ͢ΔͭΓ͋Γ·ͤΜ
w ܕΛॻ͔ͣʹɺܕͷϝϦοτΛڗड͍ͨ͠ w 3#4ͩͱΞϓϦͰ·ͩܕΛॻ͘ίετ͕ߴ͘ ࠳ં͢ΔͷΛݟ͔͚Δ %3:Ͱͳ͘ਏ͍ w 3#*ͷಋೖίʔυ3VCZʹݟ͑ͣਏ͍ w
ྫ͑3#4͕πʔϧؒͷཪଆͷϨΠϠʔݴޠ ʹͳΔະདྷʁ நղऍͱ͍͏ୈͷಓ
:+*5
w .+*5ʹՃ͑ͯ-##7ʹج͍ͮͨ4IPQJGZ +*5Ͱ͋Δ:+*5͕ಋೖ͞Εͨ w 3BJMTΞϓϦͰ༗ޮԽͨ͠ޮՌଌఆ͕ʹ ͳΔ͜ͱ͕͋Δ͚ΕͲ-41ͰΫϥΠΞϯτ ͔ΒRUBY_YJIT_ENABLED=trueͯ͠ΈΑ͏ w FHWTDPEFSVCPDPQ TUFFQWTDPEF
:+*5
3VTU:+*58"4.
w :+*5ͷ࣮͕3VTUʹͳͬͨ w 3VTU:+*5ͷϏϧυͰࠔΔͱ͍͏ΛपลͰ ฉ͔ͳ͍ w %0$,&30''*$*"-*."(&͕ΘΕ͍ͯΔ ͷ͔ɺ3VTUΠϯετʔϧڭཆͳͷ͔ɺ :+*5ແޮͰͷϏϧυͱ͍ͯ͠Δͷ͔ 3VTU:+*5
w ࠷ۙ5SZ3VCZͷσϑΥϧτ͕0QBM͔Β 8"4.ʹͳ͍ͬͯͨ ΑΓྑ͍ೖʹ 8FC"TTFNCMZ 8"4. IUUQTUSZSVCZMBOHPSHQMBZHSPVOE
w ਖ਼نදݱ·ΘΓվળʹΑΔ3F%P4߈ܸରࡦ ࣮༻త w 3FBEPOMZͷStruct.new૬ͱͯ͠ Data.define͕ಋೖ͞Εͨ w 3BDUPSͷར༻ʹؔΘ͍͖ͬͯͦ͏ ͷݸਓతਪ͠
6OJWFSTBM1BSTFS3BDJOH
-SBNBBOE:"31 6OJWFSTBM1BSTFSݖ૪ୣͷηϝϯτ
w !KVOL-SBNBίϯτϦϏϡʔλʔ w !4)QBSTFZίϯτϦϏϡʔλʔ w !LPJD1BSTFSHFNίϛολʔ w !JNB[VNJ*3#ίϛολʔ w !GVHBLLCO3#4ίϯτϦϏϡʔλʔ
ߏจղੳثݚڀ෦ IUUQTNBHB[JOFSVCZJTUOFUBSUJDMFT'PMMPX6Q,JSJTIJNB3VCZIUNM
"CPWF"MM .BLF*U'VO