Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Ruby for your two internal programmers

Ruby for your two internal programmers

My Arrrrcamp 2013 talk

Ee64bbdcdeffabc6d4166a96e6d2a0d5?s=128

Jano González

October 03, 2013
Tweet

Transcript

  1. None
  2. None
  3. HELLO GHENT!

  4. B - AT = G

  5. PIRATES

  6. RUBY FOR BIPOLAR PROGRAMMERS

  7. $ whoami

  8. @janogonzalez

  9. @hop_in

  10. PIRATES IN CHILE

  11. XVI CENTURY

  12. SIR FRANCIS DRAKE

  13. HERO OR PIRATE?

  14. AKA EL DRAKE

  15. 6.5M$ REWARD

  16. SIR FRANCIS DRAKE

  17. SIR FRANCIS DRAKE

  18. HIDDEN TREASURES

  19. ISLA MOCHA

  20. MOCHA DICK

  21. XXI CENTURY

  22. NEW PIRATES

  23. NEW PIRATES

  24. NEW PIRATES

  25. ☑ PIRATES ☐ RUBY

  26. A TALE OF TWO DEVELOPERS

  27. HACKER V/S THINKER

  28. HACKER

  29. GET THINGS DONE

  30. FAST

  31. HACKS

  32. MAINTENANCE NIGHTMARE

  33. NEEDS MORE DUCT TAPE

  34. THINKER

  35. THINKS ABOUT ABSTRACTIONS

  36. THINKS ABOUT MAINTAINABILITY

  37. TOO MANY ABSTRACTIONS

  38. ANALYSIS PARALYSIS

  39. NEEDS MORE LAYERS

  40. MY HISTORY

  41. A TRILOGY OF MOVIES

  42. THE HACKER YEARS

  43. THE HACKER YEARS

  44. THE LEARNING YEARS

  45. THE UML YEARS

  46. THE UML YEARS

  47. THE HACKER WAS GONE

  48. UML, RUP, GoF, XML, ETC.

  49. STOCKHOLM SYNDROME

  50. EVOLUTION?

  51. THE ONE TRUE WAY™

  52. THE PATH?

  53. FEAR

  54. I WAS SO WRONG!

  55. EVERYDAY LIFE IS THE PATH

  56. ENTER RUBY

  57. SMALLTALK IN PERL’S DISGUISE

  58. HAPPY THINKER

  59. THINKER class AccountProtectionProxy def initialize(real_account, owner) @subject = real_account @owner

    = owner end def method_missing(name, *args) check_access @subject.send(name, *args) end ...
  60. OMG! GoF NEVER WAS SO EASY

  61. HAPPY HACKER

  62. HACKER $1 if str ~= /(foo)+/

  63. ONE LINERS FTW!

  64. HACKER ❤ THINKER

  65. LET’S WORK TOGETHER

  66. HARMONY

  67. HARMONY (1..42).select(&:even?). map { |n| n * 2 }. reduce(&:*)

  68. EXPRESS YOURSELF

  69. EXPRESS YOURSELF File.open('my.txt').each do |line| puts line if line =~

    /jano/ end
  70. THE HIDDEN TRUTH

  71. HIDDEN TRUTH $ irb > puts 'Ahoy World!' # Ahoy

    World! # => nil
  72. HIDDEN TRUTH > self.class # => Object

  73. HIDDEN TRUTH > Object.included_modules # => [Kernel]

  74. HIDDEN TRUTH > Kernel.methods.include? :puts # => true

  75. THE MOST HIDDEN TRUTH

  76. THE PATH IS NO PATH

  77. THE PATH

  78. WORKING TOGETHER

  79. HACKER

  80. EXPLORE NEW TERRITORY

  81. THINKER

  82. FIND ACCEPTANCE CRITERIA

  83. DEFINE COMPONENTS

  84. BALANCE

  85. DELIVER VALUE V/S DIMINISH TECHNICAL DEBT

  86. CREATIVITY V/S STANDARDIZATION

  87. EXAMPLE

  88. CASE STATEMENT V/S FACTORY + COMMANDS

  89. EXAMPLE case account_type when :premium then # do stuff when

    :standard then # do stuff when :personal then # do stuff end
  90. EXAMPLE class AccountAccount def initialize # do stuff end def

    execute(context) # do stuff end end
  91. EXAMPLE class PersonalFactory def self.create(type) name = "#{type.capitalize} Account" klass

    = Kernel.const_get(name) klass.new end end
  92. EXAMPLE AccountFactory .create(account_type) .execute(context)

  93. IMPLICIT V/S EXPLICIT

  94. CLARITY V/S DRY

  95. CLARITY V/S SRP

  96. NOW V/S FUTURE

  97. MY HUMBLE ADVICE

  98. LEARN ABOUT BEST PRACTICES

  99. DON’T FOLLOW BLINDLY YOUR FUNCTIONAL GURU

  100. DON’T FOLLOW BLINDLY YOUR OO GURU

  101. TESTS + REFACTORING

  102. HOW TO IMPROVE

  103. HACKER

  104. LEARN ABOUT OOP & PATTERNS

  105. TRY IMMUTABILITY & SEQUENCES

  106. DO SEPARATE RESPONSIBILITIES

  107. THINKER

  108. LEARN ABOUT ONE LINERS

  109. TRY CODE GOLF

  110. DO EVIL STUFF

  111. EVERYONE

  112. READ A LOT OF CODE

  113. WRITE A LOT OF CODE

  114. ONE LAST ADVICE

  115. कഁ཭

  116. SHU कഁ཭

  117. HA कഁ཭

  118. RI कഁ཭

  119. None
  120. CONCLUSIONS

  121. RUBY GIVES YOU FREEDOM

  122. LETS YOU STRIVE FOR BALANCE

  123. AVOID CARGO CULT

  124. GOOD ADVICE V/S LAWS

  125. THERE IS NO TRUE PATH

  126. IF YOU MEET THE BUDDHA IN THE ROAD, KILL HIM!

  127. FOLLOW YOUR ❤

  128. THANK YOU! ❤

  129. IMAGES • http://en.wikipedia.org/wiki/File: 1590_or_later_Marcus_Gheeraerts,_Sir_Francis_Drake_Buckland_Abbey, _Devon.jpg • http://en.wikipedia.org/wiki/File:New_Albion._English_galleon_ %22Golden_Hinde %22_by_Sir_Francis_Drake._Oil_on_canvas._60_x_90_cm..jpg •

    http://en.wikipedia.org/wiki/File:DRAKE_1577-1580.png • http://www.vivimoslanoticia.cl/wp-content/uploads/2013/09/Pel %C3%ADculas-piratas.jpg • http://radiopolar.com/images/noticias/20101127174025.jpg • http://upload.wikimedia.org/wikipedia/commons/a/aa/Isla_Mocha_1.jpg • http://www.todayifoundout.com/wp-content/uploads/2011/12/Moby- Dick-3.jpg