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
誰も全体を知らない ~ ロールの垣根を超えて引き上げる開発生産性 / Boosting Development Productivity Across Roles
kakehashi
1
230
Terraform Stacks入門 #HashiTalks
msato
0
360
適材適所の技術選定 〜GraphQL・REST API・tRPC〜 / Optimal Technology Selection
kakehashi
1
680
[CV勉強会@関東 ECCV2024 読み会] オンラインマッピング x トラッキング MapTracker: Tracking with Strided Memory Fusion for Consistent Vector HD Mapping (Chen+, ECCV24)
abemii
0
220
第1回 国土交通省 データコンペ参加者向け勉強会③- Snowflake x estie編 -
estie
0
130
BLADE: An Attempt to Automate Penetration Testing Using Autonomous AI Agents
bbrbbq
0
320
AWS Lambdaと歩んだ“サーバーレス”と今後 #lambda_10years
yoshidashingo
1
180
Flutterによる 効率的なAndroid・iOS・Webアプリケーション開発の事例
recruitengineers
PRO
0
110
SSMRunbook作成の勘所_20241120
koichiotomo
3
160
Terraform未経験の御様に対してどの ように導⼊を進めていったか
tkikuchi
2
450
Lambdaと地方とコミュニティ
miu_crescent
2
370
プロダクト活用度で見えた真実 ホリゾンタルSaaSでの顧客解像度の高め方
tadaken3
0
150
Featured
See All Featured
VelocityConf: Rendering Performance Case Studies
addyosmani
325
24k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
jQuery: Nuts, Bolts and Bling
dougneiner
61
7.5k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2.1k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
109
49k
Designing Experiences People Love
moore
138
23k
Building Applications with DynamoDB
mza
90
6.1k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
364
24k
Principles of Awesome APIs and How to Build Them.
keavy
126
17k
Optimizing for Happiness
mojombo
376
70k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
226
22k
How to train your dragon (web standard)
notwaldorf
88
5.7k
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