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
480
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
ドメイン名の終活について - JPAAWG 7th -
mikit
33
20k
DMARC 対応の話 - MIXI CTO オフィスアワー #04
bbqallstars
1
160
AGIについてChatGPTに聞いてみた
blueb
0
130
New Relicを活用したSREの最初のステップ / NRUG OKINAWA VOL.3
isaoshimizu
2
600
【Pycon mini 東海 2024】Google Colaboratoryで試すVLM
kazuhitotakahashi
2
500
信頼性に挑む中で拡張できる・得られる1人のスキルセットとは?
ken5scal
2
530
テストコード品質を高めるためにMutation Testingライブラリ・Strykerを実戦導入してみた話
ysknsid25
7
2.6k
CysharpのOSS群から見るModern C#の現在地
neuecc
2
3.2k
Lambdaと地方とコミュニティ
miu_crescent
2
370
ノーコードデータ分析ツールで体験する時系列データ分析超入門
negi111111
0
410
TypeScript、上達の瞬間
sadnessojisan
46
13k
障害対応指揮の意思決定と情報共有における価値観 / Waroom Meetup #2
arthur1
5
470
Featured
See All Featured
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
0
89
Testing 201, or: Great Expectations
jmmastey
38
7.1k
A designer walks into a library…
pauljervisheath
204
24k
The Power of CSS Pseudo Elements
geoffreycrofte
73
5.3k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
120
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
329
21k
It's Worth the Effort
3n
183
27k
The Art of Programming - Codeland 2020
erikaheidi
52
13k
Site-Speed That Sticks
csswizardry
0
24
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Typedesign – Prime Four
hannesfritz
40
2.4k
Become a Pro
speakerdeck
PRO
25
5k
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