Complexity

 Complexity

A short talk about complexity, delivered at Bath Ruby 2016

76c1414a09f42ad83b2296a8cdcd11a9?s=128

John Cinnamond

March 11, 2016
Tweet

Transcript

  1. @jcinnamond Complexity

  2. As a business

  3. As a business I want A/B testing on the 


    homepage
  4. As a business I want A/B testing on the 


    homepage Because business
  5. GREAT!

  6. There’s a GEM
 for that GREAT!

  7. source 'https://rubygems.org' gem 'rails', '4.2.5.2' group :development, :test do gem

    'byebug' end
  8. source 'https://rubygems.org' gem 'rails', '4.2.5.2' group :development, :test do gem

    'byebug' end gem 'ab-testing-because-business'
  9. $ bundle install Using rake 10.5.0 Using rails 4.2.5.2 Installing

    ab-testing-because-business Using node 6.0.1 Using vb.net 14.0 Using microsoft-iis 5.1
  10. rails g ab-testing:init invoke ab_test_all_the_things modify app/views/homepage.html.erb convert_all_the_users $

  11. rails g ab-testing:init invoke ab_test_all_the_things modify app/views/homepage.html.erb convert_all_the_users $ :shipit:

  12. Everyone is happy

  13. Everyone is happy Everything is EASY

  14. As a user

  15. As a user I want some copy
 changed

  16. As a user I want some copy
 changed Because reasons

  17. GREAT!

  18. There’s a GEM
 for that GREAT!

  19. source 'https://rubygems.org' gem 'rails', '4.2.5.2' gem 'ab-testing-because-business' group :development, :test

    do gem 'byebug' end
  20. source 'https://rubygems.org' gem 'rails', '4.2.5.2' gem 'ab-testing-because-business' group :development, :test

    do gem 'byebug' end gem 'awesome-copy-change'
  21. $ bundle install Using rake 10.5.0 Using peoples-front-of-judea 1.4.3 Using

    judean-peoples-front 2.1.0 Using judean-popular-peoples-front 0.9 Using ab-testing-because-business 1.0 Installing awesome-copy-change 0.1 Using romanes-eunt-domus 1.0.0-beta3 A møøse once bit my sister…
  22. AwesomeCopyChange.config do |config| change 'romanus eunt domus', to: 'romani ite

    domum' end config/initializers/awesome_copy_change.rb
  23. AwesomeCopyChange.config do |config| change 'romanus eunt domus', to: 'romani ite

    domum' end config/initializers/awesome_copy_change.rb :shipit:
  24. Everyone is happy

  25. Everyone is happy Everything is EASY

  26. 47% of rails development is installing gems* * I totes

    just made this up
  27. $ grep -c '^\s*gem' Gemfile 40 $ bundle list |

    grep -c '\*' 122
  28. $ bundle install --path=vendor/bundle ...

  29. $ bundle install --path=vendor/bundle ... $ find vendor/bundle/ruby/2.3.0/gems -name \*.rb

    |
  30. $ bundle install --path=vendor/bundle ... $ find vendor/bundle/ruby/2.3.0/gems -name \*.rb

    | egrep -v 'spec|test' |
  31. $ bundle install --path=vendor/bundle ... $ find vendor/bundle/ruby/2.3.0/gems -name \*.rb

    | egrep -v 'spec|test' | wc -l
  32. $ bundle install --path=vendor/bundle ... $ find vendor/bundle/ruby/2.3.0/gems -name \*.rb

    | egrep -v 'spec|test' | wc -l 4234
  33. $ find vendor/bundle/ruby/2.3.0/gems -name \*.rb | egrep -v 'spec|test' |

  34. $ find vendor/bundle/ruby/2.3.0/gems -name \*.rb | egrep -v 'spec|test' |

    xargs cat |
  35. $ find vendor/bundle/ruby/2.3.0/gems -name \*.rb | egrep -v 'spec|test' |

    xargs cat | grep '^\s*def\b' |
  36. $ find vendor/bundle/ruby/2.3.0/gems -name \*.rb | egrep -v 'spec|test' |

    xargs cat | grep '^\s*def\b' | wc -l
  37. $ find vendor/bundle/ruby/2.3.0/gems -name \*.rb | egrep -v 'spec|test' |

    xargs cat | grep '^\s*def\b' | wc -l 35454 (methods)
  38. $ find vendor/bundle/ruby/2.3.0/gems -name \*.rb | egrep -v 'spec|test' |

    xargs cat | grep '^\s*def method_missing\b' | wc -l 35454 (methods) 93 (method_missing)
  39. $ find vendor/bundle/ruby/2.3.0/gems -name \*.rb | egrep -v 'spec|test' |

    xargs cat | grep '^\bdefine_method\b' | wc -l 35454 (methods) 93 (method_missing) 205 (define_method)
  40. ¯\_(ϑ)_/¯

  41. $ find app -name '*.rb' | xargs cat | grep

    -v '^\s*#' | grep -v '^\s*$' | wc -l 1007
  42. $ find vendor/bundle/ruby/2.3.0/gems -name \*.rb | egrep -v 'spec|test' |

    xargs cat | grep -v '^\s*#' | grep -v '^\s*$' | wc -l 377195
  43. 100% Our code Other people's code

  44. 0 100000 200000 300000 400000 Code that's been through our

    PR process Code that hasn't
  45. Projects get COMPLEX

  46. Rails projects get COMPLEXERERER

  47. GEMS
 aren't the problem

  48. Solve problems by DOING STUFF

  49. Solve problems by DOING STUFF Adding a gem

  50. Solve problems by DOING STUFF Adding a gem Running scripts

  51. Solve problems by DOING STUFF Adding a gem Running scripts

    Writing code
  52. Solve problems by DOING STUFF Adding a gem Running scripts

    Writing code ADDING COMPLEXITY
  53. COMPLEXITY KILLS PROJECTS

  54. Avoid complexity by

  55. Avoid complexity by DOING LESS STUFF

  56. Avoid complexity by DOING LESS STUFF THINKING MORE

  57. Avoid complexity by DOING LESS STUFF THINKING MORE CARING MORE

  58. This takes time

  59. Nobody is happy

  60. Nobody is happy Nothing is EASY

  61. AVOIDING COMPLEXITY isn't always
 the right thing

  62. But it's about balance

  63. COMPLEXITY KILLS PROJECTS

  64. COMPLEXITY KILLS PROJECTS nobody likes a dead project

  65. Great! 
 There's a 
 gem for this

  66. I can bash 
 out out 
 some code

  67. maybe don't think that I can bash 
 out out

    
 some code
  68. try thinking 
 about the 
 problem I can bash

    
 out out 
 some code
  69. try to find
 the SIMPLE
 solution I can bash 


    out out 
 some code
  70. IN THE SHORT TERM nobody cares

  71. IN THE LONG TERM your project depends on it

  72. Thank you Complexity @jcinnamond Bath Ruby 2016