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
Good interface: Command pattern as an example
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Masafumi Okura
June 08, 2019
Programming
1.4k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Good interface: Command pattern as an example
Masafumi Okura
June 08, 2019
More Decks by Masafumi Okura
See All by Masafumi Okura
Conference as a communication hub for all of us
okuramasafumi
0
57
Metaprogramming isn't real, it can't hurt you
okuramasafumi
0
160
Developing static sites with Ruby
okuramasafumi
1
440
Why doesn't Ruby have Boolean class - final version
okuramasafumi
0
410
Reading Rails 1.0 Source Code
okuramasafumi
0
370
RDoc meets YARD
okuramasafumi
4
260
Why doesn't Ruby have Boolean class?
okuramasafumi
0
60
My KaigiEffect at RubyKaigi 2025, part 1
okuramasafumi
1
110
Writing documentation can be fun with plugin system
okuramasafumi
0
280
Other Decks in Programming
See All in Programming
Language Server 使ってる? 〜VSCode と Zed の場合〜 / Are you using a Language Server? ~For VS Code and Zed~
handlename
0
780
LLM本来の能力を解き放つサンドボックス技術とAI民主化への適用
yukukotani
3
3.6k
Make SRE Operations Easier with Azure SRE Agent
kkamegawa
0
5.3k
3Dシーンの圧縮
fadis
1
730
TypeScript+Orvalで実現する型安全かつ堅牢でスケーラブルなマルチチャネル通知基盤 / TSKaigi Night talks ~after conference~
d0riven
0
320
並列実装の現場、2ヶ月間実務でAIを使い倒したAIもPCも私も限界が近い
ming_ayami
0
120
「エンジニアインターン、どうやって取った?」準備のリアルを語るLT会 Progate BAR
akiomatic
0
130
Modding RubyKaigi for Myself
yui_knk
0
920
セキュリティの専門家じゃなくてもできる。「セキュリティ意識」をアップデートして サプライチェーン攻撃への耐性を高めよう。
tk3fftk
5
710
CSC307 Lecture 17
javiergs
PRO
0
320
Skillsは効率化、Agentsは"自分の拡張"——Builder時代のエージェント編成(CC Night 2026)
wemra
1
120
AI時代のUIはどこへ行く?その2!
yusukebe
21
7k
Featured
See All Featured
Raft: Consensus for Rubyists
vanstee
141
7.5k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.4k
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.7k
Faster Mobile Websites
deanohume
310
31k
AI: The stuff that nobody shows you
jnunemaker
PRO
8
710
Being A Developer After 40
akosma
91
590k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
360
Crafting Experiences
bethany
1
180
Designing for humans not robots
tammielis
254
26k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
1.1k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.2k
The Cult of Friendly URLs
andyhume
79
6.9k
Transcript
ྑ͍ΠϯλʔϑΣΠεͷ୳ٻ ίϚϯυύλʔϯΛྫʹ େխ࢙ʢ@okuramasafumiʣ ໊ݹRubyձٞ04―େਢԋܳ 2019-06-08ʢʣ
ࠓͷൃද͕͋ͪͪ͜ʹ ભҠ͍͖ͯ͠·͢ɻ མޠͩͱࢥָͬͯ͠Έͳ͕Β ͓͔͚͖͍ͬͯͯͩ͘͞!
pp self • ໊લɿ͢ͱ·͞;Έʢେխ࢙ʣ • ॴଐɿϑϦʔϥϯε • ׆ಈॴɿ౦ژ • ͖ͳgemɿPry,
RSpec • ӡӦͯ͠ΔίϛϡχςΟɿGrow.rb
໊ݹRubyձٞ
໊ݹRubyձٞ
զʑͳͥRubyΛ͏ͷ͔
Rubyͷ
զʑͳͥRubyΛ͏ͷ͔ • ॻ͖͍͢ • ʮॻ͖͢͞ʯͬͯͳΜͩΖ͏ • ಡΈ͍͢ • ʮಡΈ͢͞ʯͬͯ(ry •
Rails
զʑ͕RubyΛ͏ཧ༝
ϓϩάϥϛϯάָ͕͍͠
ͳͥRubyͰϓϩάϥϛϯάΛ͢Δͱ ָ͍͠ͷͩΖ͏͔ʁ
https://www.atmarkit.co.jp/news/ 200907/24/ruby2.html
yuguiɿ ͦΕɺίϨΫγϣϯ͕͋ͬͯγϟοϑϧ ͍ͨ͠ͱࢥͬͨΒɺshuffleͱॻ͍ͯɺͦΕ Ͱಈ͔ͳ͖Ό͍͚ͳ͍ΜͰ͢Αɻ
ࢥͬͨͱ͓Γʹಈ͘ ʢৗʹಈ͘ͱݴ͍ͬͯͳ͍ʣ
ͱ͜ΖͰɿ ͳΜͰ͜ͷΛ͍ͯ͠Δͷ͔
ָ͘͠ϓϩάϥϛϯάͰ͖Δ ྖҬΛ͍͛ͨʂ
ϥΠϒϥϦΛॻ͍ͯΈΑ͏ →ॻ͖·ͨ͠
https://github.com/okuramasafumi/ neco
150ߦͪΐ͍ͷϥΠϒϥϦ
2ճ΄Ͳॻ͖͍ͯ͠Δ
ΠϯλʔϑΣΠεʹೲಘ͕͍͔ͳ͔ͬͨ
ΠϯλʔϑΣΠεʹ͍ͭͯ ͍Ζ͍Ζߟ͑ͨͷͰɺ ͦͷՌʢʁʣΛڞ༗͍ͨ͠
ͦͦɿ ΠϯλʔϑΣΠεͬͯ ͳΜ͚ͩͬʁ
Interface (MacOSͷࣙॻΑΓ) 1. a point where two systems, subjects, organizations,
etc. meet and interact 2. Computing a device or program enabling a user to communicate with a computer
ΠϯλʔϑΣΠε ίϯϐϡʔλͱͷίϛϡχέʔγϣϯ ͷͱΓํΛܾఆ͢Δͷ
ΠϯλʔϑΣΠεʹϝιου
ΠϯλʔϑΣΠεʹϝιουγάχνϟ
ʮࢥͬͨͱ͓Γʹಈ͘ʯ
Ruby ΠϯλʔϑΣΠεʢ㲓ϝιουγάχνϟʣ ͕ྑ͍͔ΒΘΕ͍ͯΔ
DSL
ҎԼɺ ʮDSLʯʮݴޠDSLʯΛࢦ͠·͢
Domain Specific Language
Ruby͕ΘΕΔཧ༝ͷҰͭ
RubyʹΑΔDSLͷ۩ମྫ • ActiveRecordʢRailsܥʣ • RakeʢϏϧυܥʣ • RSpecʢBDDʣ • PuppetChefɺVagrantʢDevOpsܥʣ •
HomebrewʢύοέʔδϚωʔδϟʣ
ڞ௨
DSLԿ͔Λఆ͍ٛͯ͠Δ
RubyʹΑΔDSLͷ۩ମྫʢ࠶ܝʣ • ActiveRecordʢRailsܥʣ • RakeʢϏϧυܥʣ • RSpecʢBDDʣ • PuppetChefɺVagrantʢDevOpsܥʣ •
HomebrewʢύοέʔδϚωʔδϟʣ
RubyʹΑΔDSLͷ۩ମྫʢఆٛྫ͖ʣ • ActiveRecordʢσʔλϞσϧͷఆٛʣ • RakeʢϏϧυϓϩηεͷఆٛʣ • RSpecʢ·ΕΔৼΔ͍ͷఆٛʣ • PuppetChefɺVagrantʢ֤छΠϯϑϥϦιʔεͷఆٛʣ •
Homebrewʢύοέʔδͷఆٛʣ
ͱ͜ΖͰɿ DSL୯ͳΔΫϥεϝιου ʢͷ߹͕ଟ͍ʣ
ͭ·Γɿ DSL·ͨΠϯλʔϑΣΠε
͜͜·Ͱͷ·ͱΊ • ΠϯλʔϑΣΠε͕ྑ͍ͱָ͘͠ϓϩάϥϛϯάͰ͖Δ • ΠϯλʔϑΣΠεͱ͍͍ͩͨϝιουγάχνϟͷ͜ͱ • ֤ॴͰΘΕ͍ͯΔDSL࣮ͨͩͷϝιου • DSLʮఆٛʯʹڧ͍ •
ΠϯλʔϑΣΠεʮ७ਮͳϝιουʯͱDSLʹ͚ΒΕΔ
https://rubykaigi.org/2019/ presentations/tanaka_akr.html
ྑ͍ΠϯλʔϑΣΠεͬͯ ͳΜͩΖ͏ʁʁʁ
⚠ ͜Εͯ͢ࢲͷ୯ͳΔҰҙݟͰ͢ Ͳ͔ͬͪͱ͍͏ͱ͕΄͍͠… ࠙ձͰ͓͠·͠ΐ͏
ྑ͍ΠϯλʔϑΣΠεͷ̏ݪଇ • ໎Θͳ͍ • ґଘ͠ͳ͍ • ͤ͗͢ͳ͍
໎Θͳ͍ • ϝιου໊ʹࡾ୯ݱͷʮsʯඞཁ͚ͩͬʁ • ͋ͷΫϥεcallͰݺͿΜ͚ͩͬɺperform͚ͩͬʁ • Πϯελϯεϝιου͚ͩͬɺΫϥεϝιου͚ͩͬʁ • Ҿͷॱংʁ
ґଘ͠ͳ͍ • ϝιουνΣʔϯΛલఏͱ͠ͳ͍ʢಛఆͷฦΓʹґଘ͠ͳ ͍ʣ • ςετ࣌ͷελϒ͕ߴʑҰͭͰࡁΉ
ͤ͗͢ͳ͍ • ΤϯυϢʔβʔ͕ࣗྗͰͰ͖Δ͜ͱΒͳ͍ • ୯७ͳόϦσʔγϣϯʹෳࡶͳDSLຊʹඞཁ͔ʁ • ΤϯυϢʔβʔ͕ࣗྗͰΓͮΒ͍͜ͱΛΔ • νΣʔϯͨ͠ϩʔϧόοΫॲཧࣗྗͰ͍͠ʢޙड़ʣ
௨ৗͷϝιου͔DSL͔ɺ ͦΕ͕ͩ
શ෦ϝιουͰ͍͍͡ΌΜɺ DSLͱ͔֮͑Δͷେมͩ͠ʂ Pure Ruby࠷ߴʂ
ͱࢥͬͯͨ࣌ظ͕ʹ͋Γ·ͨ͠…
ϝιουΠϯλʔϑΣΠεͷॴ • ҾselfͳͲ͕ࣗ໌ • ܧঝͨ͠ͱ͖ʹಈ࡞͕ཧղ͍͢͠ • ͦ͜ʹʮࠇຐज़ʯͳ͍
ϝιουΠϯλʔϑΣΠεͷॴ • ॊೈͳڍಈΛఏڙ͢ΔࡍʹϢʔβʔ͕ॻ͖͘ϝιου͕ࡶ ʹͳΓ͕ͪ • ϥΠϒϥϦ͕ϑϩʔΛίϯτϩʔϧ͠Α͏ͱ͢Δࡍʹඞཁͳ ϑοΫΛࠩ͠ڬΉͷ͕͍͠ʢϢʔβʔʹଟͷϝιουΛఆ ٛͯ͠Β͏ඞཁ͕ग़ͯ͘Δʣ
DSLͷॴ • ϒϩοΫҾϝιουҾΑΓॊೈ • దʹ໋໊͞Ε͍ͯΔ߹ɺՄಡੑ͕ߴ͍ • ϥΠϒϥϦ͕ҙͷॲཧΛϢʔβʔఆٛͷॲཧʹڬΈࠐΊΔ ʢϑοΫΩϟογϡͳͲʣ • ԿΛ͍ͨ͠ͷ͔ͷʮఆٛʯΛએݴతʹॻ͚Δ
DSLͷॴ • ʮࠇຐज़ʯ͕ଟ͘ͳΓ͕ͪͷͰɺڍಈΛਖ਼֬ʹѲ͢Δͷ͕ࠔ • దʹ໋໊͞Ε͍ͯͳ͍߹ɺՄಡੑ͕ஶ͘͠མͪΔέʔε͕ ͋Δ • ϝλϓϩάϥϛϯάΛར༻͢Δ߹ɺσόοά͕ࠔʹͳΔ
ॊೈੑͷͰDSL͕༏Ґ
͡Ό͋શ෦DSLΛ༻ҙ͠·͘Ε ͦΕͰ͍͍ͷ͔ʂʁ
ࠇຐज़͡Όͳ͍ͷͦΕʁ
DSLຐज़͕͍ ʢby Joker1007ʣ
அ͕͍͠έʔε
ྫɿ όϦσʔγϣϯఆٛͳͷͰDSLΛ͏ ͔͠͠ɺܕνΣοΫΛDSLͰߦ͏͖͔ʁ
ճྫɿ ͤ͗͢ͳ͍ݪଇʹै͍ɺ࣮ࡍͷ όϦσʔγϣϯϢʔβʔʹͤΔɺ ϥΠϒϥϦόϦσʔγϣϯఆٛͷ ϑοΫDSLͷΈఏڙ
۩ମྫ ʢࠓճͷυϝΠϯίϚϯυύλʔϯʣ
NecoϏδωεϩδοΫΛ ʮίϚϯυʯʹׂ͠ɺ ͦΕΒΛΈ߹ΘͤΔϑϩʔΛ ࢧԉ͢ΔϥΠϒϥϦ
·ͱΊ • ͔ͤͬ͘RubyͰॻ͍ͯΔΜ͔ͩΒΠϯλʔϑΣΠεʹͩ͜Θ Γ͍ͨʢָ͍ͬͯ͠ϥΠϒϥϦ͕΄͍͠ʣ • DSLRubyͷڧΈͰ͋Γɺదʹ໋໊ɾ࣮͢Ε୯७ͳϝ ιουΑΓॊೈͳఆٛΠϯλʔϑΣΠεΛఏڙͰ͖Δ • ͕Μͬͯॊೈͳ͍উखΛࢦͯ͠ΔͷͰNecoͬͯ͘ΕΑͳʢએʣ