Save 37% off PRO during our Black Friday Sale! »

The Master Rubyist

The Master Rubyist

Slide deck from my RubyC 2016 presentation.

Efd2550fb5f3059d815e731ecd61b701?s=128

Bozhidar Batsov

June 07, 2016
Tweet

Transcript

  1. None
  2. Божидар

  3. @bbatsov

  4. I’m back

  5. epic fail

  6. None
  7. Hakuna Matata, what a wonderful phrase Hakuna Matata, ain't no

    passing craze It means no worries for the rest of your days It's our problem free philosophy, Hakuna Matata
  8. They call me Master…

  9. … and I’m a Rubyist

  10. I must be The Master Rubyist!

  11. None
  12. Sofia, Bulgaria

  13. Sofia, Bulgaria

  14. None
  15. Tarnovo, Bulgaria

  16. None
  17. None
  18. None
  19. Dashingly handsome

  20. Sings like an angel

  21. Loves karaoke

  22. Is very responsible

  23. Was very responsible last night

  24. Loves beer

  25. Loves scotch

  26. Loves vodka

  27. Terrified by gorilka

  28. Loves Ruby

  29. Loves Ruby

  30. Loves Ruby

  31. Loves Ruby

  32. Uses tabs instead of spaces

  33. Uses vim

  34. None
  35. Emacs fanatic

  36. Star Wars fanatic

  37. Batman

  38. None
  39. Loves OSS

  40. Does some OSS development

  41. None
  42. On the core team of some projects

  43. Works for a famous company

  44. None
  45. Loved by his team

  46. None
  47. Loved by his team

  48. The Master Rubyist D[$Q\JKFCT$CVUQX

  49. Master

  50. having or showing very great skill or proficiency

  51. None
  52. Novice

  53. a person new to and inexperienced in a job or

    situation
  54. None
  55. Journeyman

  56. a worker, performer, or athlete who is experienced and good

    but not excellent
  57. None
  58. The Road to Mastery

  59. None
  60. not really

  61. try 10 years

  62. http://norvig.com/21- days.html Teach Yourself Programming in Ten Years Peter Norvig

  63. Apprenticeship

  64. Novice Journeyman Master Apprenticeship Apprenticeship

  65. Object-oriented programming

  66. None
  67. Ruby is a purely object- oriented language

  68. None
  69. None
  70. Know Thy Language!

  71. Crazy People

  72. None
  73. Ruby is a VERY COMPLEX language!

  74. class instance variable

  75. protected

  76. module_function vs extend self

  77. refinements

  78. super vs super()

  79. == === equal? eql?

  80. None
  81. None
  82. Grokking the language

  83. Understanding and appreciating its philosophy

  84. Coming to grips with reality

  85. (no language is perfect)

  86. (not even Clojure)

  87. (some languages really suck)

  88. Master the idioms

  89. for i in 1..3 puts "Hello, Kiev!" end

  90. 3.times do puts "Hello, Kiev!" end

  91. if some_condition then # body omitted end

  92. def some_method # ... return result end

  93. None
  94. None
  95. None
  96. Read some (good) code

  97. some == A LOT

  98. None
  99. Obtain a notion of style

  100. A style guide • a curated set of (supposedly) good

    practices • spares you the process of making trivial decisions • allows you to focus on the actual problems • simple and concise
  101. None
  102. Use the active voice.

  103. My first visit to Kiev will always be remembered by

    me. lame
  104. I shall always remember my first visit to Kiev. legit

  105. The word personally is often unnecessary.

  106. Personally, I love RubyC.

  107. Style guides aren’t a replacement for thinking

  108. None
  109. Write clearly -- don't be too clever.

  110. def user_signed_in? !!@current_user end def user_signed_in? !@current_user.nil? end

  111. Don't sacrifice clarity for small gains in efficiency.

  112. i = 1 res = 0 while i <= 10

    res += i i += 1 end
  113. (1..10).reduce(:+)

  114. (N * (N + 1)) / 2

  115. (10 * (10 + 1)) / 2

  116. Ruby Style Guide https://github.com/bbatsov/ruby-style-guide

  117. None
  118. Tackle problems with style

  119. None
  120. puts debugging sucks

  121. bla bla bla puts ‘********’ puts x puts ‘********’

  122. None
  123. pro “puts” debugging techniques

  124. object = Object.new puts object.method(:blank?).source_location # => ["/gems/ activesupport-5.0.0.beta1/lib/ active_support/core_ext/object/

    blank.rb", 14]
  125. class Bar def foo puts "=====================" puts caller end end

  126. def foo puts method(:foo).super_method.source_location super end

  127. def parse(input, skip_code_comments: false, ignore_whitespace: true) # do stuff end

    method(:parse).parameters #=> [[:req, :input], [:key, :skip_code_comments], [:key, :ignore_whitespace]]
  128. config.thing = { "foo" => "bar" } config.thing.freeze = {

    "foo" => "bar" } config.thing.delete("foo") # active_support/concurrency/share_lock.rb:151:in `delete': can't modify frozen Hash (RuntimeError) # from active_support/concurrency/share_lock.rb:151:in `yield_shares' # from active_support/concurrency/share_lock.rb:79:in `block in stop_exclusive'
  129. Ruby Debugging Magic Cheat Sheet http://www.schneems.com/2016/01/25/ruby-debugging- magic-cheat-sheet.html

  130. I am a puts debugger https://tenderlovemaking.com/2016/02/05/i-am-a-puts- debuggerer.html

  131. I am not a puts debugger!

  132. byebug https://github.com/deivid-rodriguez/byebug

  133. pry-byebug https://github.com/deivid-rodriguez/pry-byebug

  134. Profiling stuff

  135. ruby-prof https://github.com/ruby-prof/ruby-prof

  136. memory_profiler https://github.com/SamSaffron/memory_profiler

  137. The Editors

  138. Emacs

  139. vim

  140. Spacemacs

  141. What about the rest?

  142. None
  143. Emacs & vim are forever!

  144. None
  145. None
  146. Interactive programming

  147. The REPL is king!

  148. pry > irb

  149. Rails

  150. None
  151. Beyond Rails

  152. Opal

  153. RubyMotion

  154. System administration

  155. JRuby

  156. Alternative web frameworks

  157. Volt

  158. Hanami

  159. Padrino

  160. Sinatra

  161. Roda

  162. Keep in sync

  163. RubyWeekly

  164. Ruby5

  165. RubyRogues

  166. RubyTapas

  167. GoRails

  168. RubyConf

  169. RailsConf

  170. Always be exploring!

  171. Clojure

  172. Haskell

  173. Elm

  174. Erlang/Elixir

  175. Racket

  176. Ideas from other programming languages make us better programmers

  177. One more thing…

  178. Ruby is simply not a good fit for every possible

    problem
  179. None
  180. None
  181. Felina