Pro Yearly is on sale from $80 to $50! »

Nikita: The Ruby Secret Agent

A8e44ce1b57c2689d5a7172d15df42b5?s=47 brixen
January 29, 2012

Nikita: The Ruby Secret Agent

Talk presented at RubyConf 2011.

A8e44ce1b57c2689d5a7172d15df42b5?s=128

brixen

January 29, 2012
Tweet

Transcript

  1. Nikita THE RUBY SECRET AGENT Brian Ford / @brixen

  2. http://www.dailyyonder.com/thin-forests-swell-rural-economy/2009/01/19/1844

  3. "Ruby has the best tools" -- No One Ever

  4. http://www.lifeoptimizer.org/2008/07/23/being-happy-secrets-of-happy-people/ Ruby is a beautiful language

  5. http://www.lifeoptimizer.org/2008/07/23/being-happy-secrets-of-happy-people/ Ruby makes me happy

  6. http://ableveterans.com/able-vets-climb-mt-rainier Rails is a terrific framework

  7. Ruby is srs bsns !_!

  8. Billions of dollars

  9. Who here is paid to write Ruby?

  10. None
  11. People are leaving Ruby

  12. Node.js Clojure Scala

  13. polyglot is the new liberal

  14. All the candidates are equally qualified, but you should choose

    me
  15. MRI != Ruby

  16. http://icouldntdecide.blogspot.com/

  17. http://picasaweb.google.com/lh/photo/bayTKUSuvLPJ8em1oMPbUg This was fun...

  18. http://picasaweb.google.com/lh/photo/bayTKUSuvLPJ8em1oMPbUg ...but itʼs sooo slow

  19. Business is hard

  20. Business is customers

  21. Business decisions balance fear and greed

  22. Developers are not paid to be happy

  23. They are paid to make customers happy

  24. If developer happiness and customer happiness collide...

  25. "Twitter: From Ruby on Rails to the JVM" http://vimeo.com/29993216 Stop

    Watch Now
  26. Critical Ruby Issues Garbage collection Concurrency Performance Tools

  27. U worried bro? http://www.isiticim.com/2010/05/he-was-worried.html

  28. Smalltalk was an awesome language http://www.isiticim.com/2010/05/he-was-worried.html

  29. 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

  30. If tools are the answer, what are the questions?

  31. How do I understand this code?

  32. Fear of the unknown

  33. Solutions & Problems Optional Typing Hidden Typing Refinements -w

  34. Optional Typing

  35. Ruby is about behavior

  36. You are what you do

  37. ducktyping

  38. Classes organize code

  39. Classes support encapsulation

  40. Three pillars of OO Encapsulation Polymorphism Inheritance

  41. Inheritance: relationships between behaviors

  42. Hidden Typing Typing requirements that are concealed from Ruby code

  43. Not in Ruby

  44. Undefined or Not documented

  45. Ruby cannot participate

  46. 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"); }
  47. def wrong(a, b) unless a.kind_of? Numeric raise "must be an

    instance of Numeric" end # ... end
  48. Ruby is dictating the structure of programs

  49. brittle unnecessary wrong

  50. Types tell you what you cannot do

  51. Like all walls, people try to defeat them

  52. complexity

  53. pain

  54. Refinements

  55. One of the leading proposals...

  56. ... for ruining Ruby

  57. Primary purpose hide incompatible changes

  58. naming - powerful abstraction for handling complexity

  59. libraries - still need integration testing

  60. applications - does not help program comprehension

  61. “What if?” programming

  62. fear

  63. or arrogance

  64. horizontal vs vertical integration

  65. -w

  66. -wtf

  67. Hidden in the parser

  68. Not Ruby objects

  69. No programmatic control

  70. Not configurable

  71. No real semantic analysis

  72. Critical Ruby Issues Garbage collection Concurrency Performance Tools

  73. Ruby is bringing a knife to a gunfight

  74. Rubinius Foundations Garbage Collection Concurrency Just-in-time Compiler Tools

  75. Rubinius Status Update Concurrent threads 1.9 features Windows JIT improvements

  76. Rubinius GC

  77. Precise

  78. Generational

  79. Copying Compaction the garbage is never seen

  80. Concurrency

  81. Fully concurrent Ruby threads

  82. concurrent vs parallel

  83. hipster Actors since before they were cool

  84. Just-in-time FAAAAST

  85. OOM

  86. Tools

  87. Rubinius implements Ruby differently

  88. Rubinius uses Ruby

  89. Consistent system

  90. Trees & Leaves

  91. How does Rubinius use Ruby?

  92. homoiconic

  93. homo - same

  94. icon - symbol

  95. $ 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
  96. $ 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>]]
  97. $ irb(main):004:0> ast.to_sexp => [:lasgn, :a, [:lit, 1]]

  98. $ irb(main):005:0> "a = 1".to_sexp => [:lasgn, :a, [:lit, 1]]

  99. What is Ruby?

  100. Everything is an object

  101. class A a = 1 end module M b =

    2 end
  102. def m(a) a + b end m { |x| x

    * 1 }
  103. # ruby_script.rb puts "hello"

  104. $ 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)>
  105. $ 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 ----------------------------------------
  106. $ 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 ----------------------------------------
  107. $ 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 ----------------------------------------
  108. Everything is a CompiledMethod

  109. Rubinius uses Ruby to build a consistent system

  110. "Ruby has the best tools" -- No One Ever

  111. Nikita

  112. my idea of a tool

  113. I want you to write tools

  114. Architecture Client/Server Separate GUI Data as binding Modular gems

  115. CompiledMethod database

  116. Class browser

  117. Coverage and profiling

  118. Bytecode instrumentation

  119. $ 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
  120. AST transformation

  121. Debugging

  122. Documentation

  123. Analysis variables used before set unused variables misnamed methods code

    quality
  124. Custom tools

  125. Summary

  126. Ruby is at a critical point

  127. I did not change Ruby

  128. Available in 1.8 and 1.9

  129. Respect business that bet on Ruby

  130. http://forums.steves-digicams.com/people-photos/150189-sad-little-boy-advice-re-post-production-required.html#b

  131. I don’t want to be this kid. Do you?

  132. Help Ruby help you

  133. github.com/rubinius/rubinius

  134. github.com/brixen/nikita

  135. Thank you