Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
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
Beyond the RuboCop Defaults
koic
3
2.8k
Minify Ruby Code
koic
2
2.1k
Permanent Agility
koic
37
7.6k
RuboCop: LSP and Prism
koic
3
4.1k
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
Software Craftsmanship against Nova Era
koic
0
1.7k
Other Decks in Programming
See All in Programming
Missing parts when designing and implementing Android UI
ericksli
0
360
「天気予報があなたに届けられるまで」 - NIFTY Tech Talk #22
niftycorp
PRO
0
130
Djangoの開発環境で工夫したこと - pre-commit / DevContainer
hiroki_yod
1
530
cmp.Or に感動した
otakakot
3
330
事業成長を爆速で進めてきたプロダクトエンジニアたちの成功談・失敗談
nealle
3
880
React への依存を最小にするフロントエンド設計
takonda
21
8.3k
型付き API リクエストを実現するいくつかの手法とその選択 / Typed API Request
euxn23
9
4k
Vapor Revolution
kazupon
2
2.4k
Jakarta EE meets AI
ivargrimstad
0
780
[Do iOS '24] Ship your app on a Friday...and enjoy your weekend!
polpielladev
0
200
Modular Monolith Monorepo ~シンプルさを保ちながらmonorepoのメリットを最大化する~
yuisakamoto
10
3.6k
As an Engineers, let's build the CRM system via LINE Official Account 2.0
clonn
1
570
Featured
See All Featured
Fashionably flexible responsive web design (full day workshop)
malarkey
405
65k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
1
210
Producing Creativity
orderedlist
PRO
341
39k
Embracing the Ebb and Flow
colly
84
4.5k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Code Reviewing Like a Champion
maltzj
520
39k
Become a Pro
speakerdeck
PRO
25
5k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
Gamification - CAS2011
davidbonilla
80
5k
The World Runs on Bad Software
bkeepers
PRO
65
11k
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