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
Nikita: The Ruby Secret Agent
Search
brixen
January 29, 2012
Technology
6
1.8k
Nikita: The Ruby Secret Agent
Talk presented at RubyConf 2011.
brixen
January 29, 2012
Tweet
Share
More Decks by brixen
See All by brixen
Stop making mud pies!
brixen
0
79
Papers We Love - Immix mark-region garbage collector
brixen
2
680
An Ensemble of Programming Languages: How to Build a Platform for Collaboration
brixen
0
190
Types As Premature Optimization
brixen
2
470
Rubinius X
brixen
3
260
Code Is What Code Does
brixen
0
400
Augmented Ruby: The Rubinius Language Platform
brixen
2
120
The Future of Ruby
brixen
1
320
Rubinius, and the Future of Ruby
brixen
2
240
Other Decks in Technology
See All in Technology
Gradle: The Build System That Loves To Hate You
aurimas
2
150
visionOSでの空間表現実装とImmersive Video表示について / ai-immersive-visionos
cyberagentdevelopers
PRO
1
110
ExaDB-D dbaascli で出来ること
oracle4engineer
PRO
0
3.6k
Fargateを使った研修の話
takesection
0
120
Commitment vs Harrisonism - Keynote for Scrum Niseko 2024
miholovesq
6
1.1k
2024-10-30-reInventStandby_StudyGroup_Intro
shinichirokawano
1
630
AWS CodePipelineでコンテナアプリをデプロイした際に、古いイメージを自動で削除する
smt7174
1
100
VPC間の接続方法を整理してみた #自治体クラウド勉強会
non97
1
850
IaC運用を楽にするためにCDK Pipelinesを導入したけど、思い通りにいかなかった話
smt7174
1
110
新R25、乃木坂46 Mobileなどのファンビジネスを支えるマルチテナンシーなプラットフォームの全体像 / cam-multi-cloud
cyberagentdevelopers
PRO
1
130
よくわからんサービスについての問い合わせが来たときの強い味方 Amazon Q について
kazzpapa3
0
220
ABEMA のコンテンツ制作を最適化!生成 AI x クラウド映像編集システム / abema-ai-editor
cyberagentdevelopers
PRO
1
180
Featured
See All Featured
Making Projects Easy
brettharned
115
5.9k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
Become a Pro
speakerdeck
PRO
24
5k
Optimizing for Happiness
mojombo
376
69k
KATA
mclloyd
29
13k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
27
790
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
The Language of Interfaces
destraynor
154
24k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
25
1.8k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
37
1.8k
Done Done
chrislema
181
16k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
14
1.9k
Transcript
Nikita THE RUBY SECRET AGENT Brian Ford / @brixen
http://www.dailyyonder.com/thin-forests-swell-rural-economy/2009/01/19/1844
"Ruby has the best tools" -- No One Ever
http://www.lifeoptimizer.org/2008/07/23/being-happy-secrets-of-happy-people/ Ruby is a beautiful language
http://www.lifeoptimizer.org/2008/07/23/being-happy-secrets-of-happy-people/ Ruby makes me happy
http://ableveterans.com/able-vets-climb-mt-rainier Rails is a terrific framework
Ruby is srs bsns !_!
Billions of dollars
Who here is paid to write Ruby?
None
People are leaving Ruby
Node.js Clojure Scala
polyglot is the new liberal
All the candidates are equally qualified, but you should choose
me
MRI != Ruby
http://icouldntdecide.blogspot.com/
http://picasaweb.google.com/lh/photo/bayTKUSuvLPJ8em1oMPbUg This was fun...
http://picasaweb.google.com/lh/photo/bayTKUSuvLPJ8em1oMPbUg ...but itʼs sooo slow
Business is hard
Business is customers
Business decisions balance fear and greed
Developers are not paid to be happy
They are paid to make customers happy
If developer happiness and customer happiness collide...
"Twitter: From Ruby on Rails to the JVM" http://vimeo.com/29993216 Stop
Watch Now
Critical Ruby Issues Garbage collection Concurrency Performance Tools
U worried bro? http://www.isiticim.com/2010/05/he-was-worried.html
Smalltalk was an awesome language http://www.isiticim.com/2010/05/he-was-worried.html
am I going to have to use Java again? http://forums.steves-digicams.com/people-photos/150189-sad-little-boy-advice-re-post-production-required.html#b
If tools are the answer, what are the questions?
How do I understand this code?
Fear of the unknown
Solutions & Problems Optional Typing Hidden Typing Refinements -w
Optional Typing
Ruby is about behavior
You are what you do
ducktyping
Classes organize code
Classes support encapsulation
Three pillars of OO Encapsulation Polymorphism Inheritance
Inheritance: relationships between behaviors
Hidden Typing Typing requirements that are concealed from Ruby code
Not in Ruby
Undefined or Not documented
Ruby cannot participate
VALUE rb_to_float(VALUE val) { if (TYPE(val) == T_FLOAT) return val;
if (!rb_obj_is_kind_of(val, rb_cNumeric)) { rb_raise(rb_eTypeError, "can't convert %s into Float", NIL_P(val) ? "nil" : val == Qtrue ? "true" : val == Qfalse ? "false" : rb_obj_classname(val)); } return rb_convert_type(val, T_FLOAT, "Float", "to_f"); }
def wrong(a, b) unless a.kind_of? Numeric raise "must be an
instance of Numeric" end # ... end
Ruby is dictating the structure of programs
brittle unnecessary wrong
Types tell you what you cannot do
Like all walls, people try to defeat them
complexity
pain
Refinements
One of the leading proposals...
... for ruining Ruby
Primary purpose hide incompatible changes
naming - powerful abstraction for handling complexity
libraries - still need integration testing
applications - does not help program comprehension
“What if?” programming
fear
or arrogance
horizontal vs vertical integration
-w
-wtf
Hidden in the parser
Not Ruby objects
No programmatic control
Not configurable
No real semantic analysis
Critical Ruby Issues Garbage collection Concurrency Performance Tools
Ruby is bringing a knife to a gunfight
Rubinius Foundations Garbage Collection Concurrency Just-in-time Compiler Tools
Rubinius Status Update Concurrent threads 1.9 features Windows JIT improvements
Rubinius GC
Precise
Generational
Copying Compaction the garbage is never seen
Concurrency
Fully concurrent Ruby threads
concurrent vs parallel
hipster Actors since before they were cool
Just-in-time FAAAAST
OOM
Tools
Rubinius implements Ruby differently
Rubinius uses Ruby
Consistent system
Trees & Leaves
How does Rubinius use Ruby?
homoiconic
homo - same
icon - symbol
$ rbx irb(main):001:0> ast = "a = 1".to_ast => #<Rubinius::AST::LocalVariableAssignment:0xf30
@value=#<Rubinius::AST::FixnumLiteral:0xf34 @value=1 @line=1> @line=1 @name=:a @variable=nil> irb(main):002:0> ast.class => Rubinius::AST::LocalVariableAssignment
$ irb(main):003:0> ast.ascii_graph LocalVariableAssignment @line: 1 @name: :a @variable: nil
@value: \ FixnumLiteral @value: 1 @line: 1 => [["@value", #<Rubinius::AST::FixnumLiteral:0xf34 @value=1 @line=1>]]
$ irb(main):004:0> ast.to_sexp => [:lasgn, :a, [:lit, 1]]
$ irb(main):005:0> "a = 1".to_sexp => [:lasgn, :a, [:lit, 1]]
What is Ruby?
Everything is an object
class A a = 1 end module M b =
2 end
def m(a) a + b end m { |x| x
* 1 }
# ruby_script.rb puts "hello"
$ rbx irb(main):001:0> def m(a, b) irb(main):002:1> a + b
irb(main):003:1> end => #<Rubinius::CompiledMethod m file=(irb)>
$ rbx compile -e 'puts 1' -B ============= :__script__ ==============
Arguments: 0 required, 0 post, 0 total Arity: 0 Locals: 0 Stack size: 2 Lines to IP: 1: 0..8 0000: push_self 0001: meta_push_1 0002: allow_private 0003: send_stack :puts, 1 0006: pop 0007: push_true 0008: ret ----------------------------------------
$ rbx compile -e 'class A; def m; end; end'
-B -N __script__ ============= :__script__ ============== Arguments: 0 required, 0 post, 0 total Arity: 0 Locals: 0 Stack size: 6 Lines to IP: 1: 0..28 0000: push_rubinius 0001: push_literal :A 0003: push_nil 0004: push_scope 0005: send_stack :open_class, 3 0008: dup_top 0009: push_rubinius 0010: swap_stack 0011: push_literal :__class_init__ 0013: swap_stack 0014: push_literal #<Rubinius::CompiledMethod A file=(snippet)> 0016: swap_stack 0017: push_scope 0018: swap_stack 0019: send_stack :attach_method, 4 0022: pop 0023: send_stack :__class_init__, 0 0026: pop 0027: push_true 0028: ret ----------------------------------------
$ rbx compile -e 'class A; def m; end; end'
-B -N A ================== :A ================== Arguments: 0 required, 0 post, 0 total Arity: 0 Locals: 0 Stack size: 5 Lines to IP: 1: 2..15 0000: push_self 0001: add_scope 0002: push_rubinius 0003: push_literal :m 0005: push_literal #<Rubinius::CompiledMethod m file=(snippet)> 0007: push_scope 0008: push_variables 0009: send_stack :method_visibility, 0 0012: send_stack :add_defn_method, 4 0015: ret ----------------------------------------
Everything is a CompiledMethod
Rubinius uses Ruby to build a consistent system
"Ruby has the best tools" -- No One Ever
Nikita
my idea of a tool
I want you to write tools
Architecture Client/Server Separate GUI Data as binding Modular gems
CompiledMethod database
Class browser
Coverage and profiling
Bytecode instrumentation
$ rbx irb(main):001:0> class F irb(main):002:1> dynamic_method :m do |g|
irb(main):003:2* g.push :self irb(main):004:2> g.push_literal g.name irb(main):005:2> g.send :p, 1, true irb(main):006:2> g.ret irb(main):007:2> end irb(main):008:1> end => #<Rubinius::CompiledMethod m file=dynamic> irb(main):009:0> F.new.m :m => nil
AST transformation
Debugging
Documentation
Analysis variables used before set unused variables misnamed methods code
quality
Custom tools
Summary
Ruby is at a critical point
I did not change Ruby
Available in 1.8 and 1.9
Respect business that bet on Ruby
http://forums.steves-digicams.com/people-photos/150189-sad-little-boy-advice-re-post-production-required.html#b
I don’t want to be this kid. Do you?
Help Ruby help you
github.com/rubinius/rubinius
github.com/brixen/nikita
Thank you