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
Terraform Stacks入門 #HashiTalks
msato
0
360
Incident Response Practices: Waroom's Features and Future Challenges
rrreeeyyy
0
160
The Rise of LLMOps
asei
7
1.7k
飲食店データの分析事例とそれを支えるデータ基盤
kimujun
0
160
オープンソースAIとは何か? --「オープンソースAIの定義 v1.0」詳細解説
shujisado
9
1.1k
マルチモーダル / AI Agent / LLMOps 3つの技術トレンドで理解するLLMの今後の展望
hirosatogamo
37
12k
ノーコードデータ分析ツールで体験する時系列データ分析超入門
negi111111
0
420
ドメインの本質を掴む / Get the essence of the domain
sinsoku
2
160
CDCL による厳密解法を採用した MILP ソルバー
imai448
3
140
SREが投資するAIOps ~ペアーズにおけるLLM for Developerへの取り組み~
takumiogawa
1
430
Amazon CloudWatch Network Monitor のススメ
yuki_ink
1
210
ISUCONに強くなるかもしれない日々の過ごしかた/Findy ISUCON 2024-11-14
fujiwara3
8
870
Featured
See All Featured
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.8k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
420
How to train your dragon (web standard)
notwaldorf
88
5.7k
Automating Front-end Workflow
addyosmani
1366
200k
Navigating Team Friction
lara
183
14k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
28
8.2k
A Tale of Four Properties
chriscoyier
156
23k
Intergalactic Javascript Robots from Outer Space
tanoku
269
27k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
25
1.8k
Building a Scalable Design System with Sketch
lauravandoore
459
33k
Speed Design
sergeychernyshev
25
620
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
280
13k
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