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

Two programmers in one

Two programmers in one

My RubyNation 2014 talk

Jano González

June 07, 2014
Tweet

More Decks by Jano González

Other Decks in Programming

Transcript

  1. TWO PROGRAMMERS IN ONE

    View full-size slide

  2. @janogonzalez

    View full-size slide

  3. A TALE OF TWO
    DEVELOPERS

    View full-size slide

  4. HACKER
    V/S

    THINKER

    View full-size slide

  5. GET THINGS
    DONE

    View full-size slide

  6. MAINTENANCE
    NIGHTMARE

    View full-size slide

  7. NEEDS MORE DUCT TAPE

    View full-size slide

  8. THINKS ABOUT
    ABSTRACTIONS

    View full-size slide

  9. THINKS ABOUT
    MAINTAINABILITY

    View full-size slide

  10. TOO MANY
    ABSTRACTIONS

    View full-size slide

  11. ANALYSIS
    PARALYSIS

    View full-size slide

  12. NEEDS MORE LAYERS

    View full-size slide

  13. A TRILOGY OF
    MOVIES

    View full-size slide

  14. THE HACKER YEARS

    View full-size slide

  15. THE HACKER YEARS

    View full-size slide

  16. THE LEARNING YEARS

    View full-size slide

  17. THE UML YEARS

    View full-size slide

  18. THE UML YEARS

    View full-size slide

  19. THE HACKER
    WAS GONE

    View full-size slide

  20. UML, RUP, GoF,
    XML, ETC.

    View full-size slide

  21. STOCKHOLM
    SYNDROME

    View full-size slide

  22. THE ONE TRUE WAY™

    View full-size slide

  23. I WAS SO WRONG!

    View full-size slide

  24. EVERYDAY LIFE
    IS THE PATH

    View full-size slide

  25. SMALLTALK IN
    PERL’S DISGUISE

    View full-size slide

  26. HAPPY
    THINKER

    View full-size slide

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

    View full-size slide

  28. OMG! GoF NEVER
    WAS SO EASY

    View full-size slide

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

    View full-size slide

  30. ONE LINERS FTW!

    View full-size slide

  31. HACKER

    THINKER

    View full-size slide

  32. LET’S WORK
    TOGETHER

    View full-size slide

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

    View full-size slide

  34. THE PATH IS
    NO PATH

    View full-size slide

  35. WORKING TOGETHER

    View full-size slide

  36. EXPLORE
    NEW TERRITORY

    View full-size slide

  37. FIND ACCEPTANCE
    CRITERIA

    View full-size slide

  38. DEFINE
    COMPONENTS

    View full-size slide

  39. DELIVER VALUE
    V/S
    DIMINISH
    TECHNICAL DEBT

    View full-size slide

  40. CREATIVITY
    V/S
    STANDARDIZATION

    View full-size slide

  41. CASE STATEMENT
    V/S
    FACTORY + COMMANDS

    View full-size slide

  42. CASE
    STATEMENT

    View full-size slide

  43. EXAMPLE
    case account_type
    when :premium then
    # do stuff
    when :standard then
    # do stuff
    when :personal then
    # do stuff
    end

    View full-size slide

  44. FACTORY
    +
    COMMANDS

    View full-size slide

  45. EXAMPLE
    class PremiumAccount
    def initialize
    # do stuff
    end
    !
    def execute(context)
    # do stuff
    end
    end

    View full-size slide

  46. EXAMPLE
    class AccountFactory
    def self.create(type)
    name = "#{type.capitalize}Account"
    klass = Kernel.const_get(name)
    klass.new
    end
    end

    View full-size slide

  47. EXAMPLE
    AccountFactory
    .create(account_type)
    .execute(context)

    View full-size slide

  48. THE BEST
    APPROACH?

    View full-size slide

  49. IMPLICIT
    V/S
    EXPLICIT

    View full-size slide

  50. CLARITY
    V/S
    DRY

    View full-size slide

  51. CLARITY
    V/S
    SRP

    View full-size slide

  52. NOW
    V/S
    FUTURE

    View full-size slide

  53. MY HUMBLE
    ADVICE

    View full-size slide

  54. LEARN ABOUT
    BEST PRACTICES

    View full-size slide

  55. DON’T FOLLOW BLINDLY
    YOUR FUNCTIONAL GURU

    View full-size slide

  56. DON’T FOLLOW BLINDLY
    YOUR OO GURU

    View full-size slide

  57. TESTS
    +
    REFACTORING

    View full-size slide

  58. HOW TO IMPROVE
    IF YOU ARE A…

    View full-size slide

  59. LEARN ABOUT
    OOP & PATTERNS

    View full-size slide

  60. TRY IMMUTABILITY &
    SEQUENCES

    View full-size slide

  61. DO SEPARATE
    RESPONSIBILITIES

    View full-size slide

  62. LEARN ABOUT
    ONE LINERS

    View full-size slide

  63. TRY CODE GOLF

    View full-size slide

  64. DO EVIL STUFF

    View full-size slide

  65. READ A LOT OF
    CODE

    View full-size slide

  66. WRITE A LOT OF
    CODE

    View full-size slide

  67. ONE LAST ADVICE

    View full-size slide

  68. SHU
    守破離

    View full-size slide

  69. ANTIPATTERN:
    ETERNAL SHU

    View full-size slide

  70. ANTIPATTERN:
    START IN HA

    View full-size slide

  71. RUBY GIVES YOU
    FREEDOM

    View full-size slide

  72. LETS YOU STRIVE
    FOR BALANCE

    View full-size slide

  73. AVOID CARGO
    CULT

    View full-size slide

  74. GOOD ADVICE
    V/S
    LAWS

    View full-size slide

  75. THERE IS
    NO TRUE PATH

    View full-size slide

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

    View full-size slide

  77. FOLLOW YOUR

    View full-size slide

  78. THANK YOU!

    View full-size slide

  79. IMAGES
    !
    • http://commons.wikimedia.org/wiki/File:Yin_yang.svg
    • http://upload.wikimedia.org/wikipedia/commons/archive/f/
    f4/20050917122925%21Janus-Vatican.JPG

    View full-size slide