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

RubyConf Keynote - No Notes - Full Builds

92497f51734ed56687928d5fd68d870a?s=47 sarahmei
November 28, 2012

RubyConf Keynote - No Notes - Full Builds

For Confreaks to help with video processing. Deck with notes, suitable for reading, is here: https://speakerdeck.com/sarahmei/the-insufficiency-of-good-design

92497f51734ed56687928d5fd68d870a?s=128

sarahmei

November 28, 2012
Tweet

Transcript

  1. The Insufficiency of Good Design Sarah Mei Pivotal Labs

  2. http://www.flickr.com/photos/vblibrary/5740555555

  3. The Insufficiency of Good Design Sarah Mei Pivotal Labs

  4. Good Code

  5. http://www.flickr.com/photos/uggboy/4065592853

  6. Write More Good Code Sarah Mei Pivotal Labs

  7. http://www.flickr.com/photos/katerha/7071545621

  8. class StuffController def show @stuff = Stuff.find(params[:id] end end

  9. class StuffController def show @stuff = Stuff.find(params[:id] end end

  10. class StuffController def show @stuff = Stuff.find(params[:id] end end

  11. Thing C B A Z Y X

  12. http://www.flickr.com/photos/ell-r-brown/5808881905

  13. ActiveRecord ::Base C B A Z Y X

  14. C B A Z Y X The PM has not

    decided exactly what this part of our app actually does.
  15. Good code is defined by its pattern of dependencies

  16. Good Code

  17. Good Code 1. OO design principles

  18. Law of Demeter @stuff

  19. Law of Demeter @stuff @stuff.things OK

  20. Law of Demeter @stuff @stuff.things OK @stuff.things.foo.bar OK?

  21. Good Code 1. OO design principles

  22. Good Code 1. OO design principles

  23. Good Code 1. OO design principles 2. Development practices

  24. Good Code 1. OO design principles 2. Development practices 3.

  25. Good Code 1. OO design principles Other People 2. Development

    practices 3.
  26. Person Person Person Person Person Person Person

  27. Person Person Person Person Person Person Person

  28. Person Person Person Person Person Person Person

  29. The aspects of things that are most important to us

    are hidden because of their simplicity and familiarity. Wittgenstein
  30. http://www.flickr.com/photos/0742/2912757295

  31. http://www.flickr.com/photos/63085612@N00/111068688

  32. Any organization that designs a system will inevitably produce a

    design whose structure is a copy of the organization's communication structure. Text of paper: http://bit.ly/RrHWvp
  33. If you have four groups working on a compiler, you’ll

    get a four-pass compiler.
  34. http://www.flickr.com/photos/itchmo/421586877 http://www.flickr.com/photos/itchmo/421586868/

  35. Army Team Navy Team Coordinators Team structure

  36. Army Team Navy Team Coordinators Team structure Army Specific Navy

    Specific Common functions Resulting software
  37. http://www.flickr.com/photos/pagedooley/1092862034 http://www.flickr.com/photos/wjlonien/6289588338

  38. http://www.jimloy.com/games/freecell.htm FreeCell Game #11982

  39. http://www.cc2e.com

  40. http://www.cc2e.com OK

  41. None
  42. http://www.flickr.com/photos/wrote/2247307130

  43. None
  44. None
  45. H E G C B A D F

  46. H E G C B A D F

  47. H E G C B A D F Ruby Haskell

    PHP Java R Python C Hadoop
  48. http://www.flickr.com/photos/proimos/4199675334

  49. Good Code Predictors

  50. Good Code Predictors • Technical qualifications

  51. Good Code Predictors • Technical qualifications • Experience with the

    code base
  52. Good Code Predictors • Technical qualifications • Experience with the

    code base • Good communication
  53. Your team’s communication patterns are the best predictor of the

    quality of the code you produce. 1
  54. http://www.flickr.com/photos/fsse-info/4320090112

  55. http://www.flickr.com/photos/tyrian123/2131287203/

  56. http://www.flickr.com/photos/puuikibeach/4396269637

  57. class Stuff < ActiveRecord::Base include Rails.app.url_helpers def as_json {url: stuff_url(id)}

    end end
  58. class Stuff < ActiveRecord::Base include Rails.app.url_helpers def as_json {url: stuff_url(id)}

    end end
  59. class Stuff < ActiveRecord::Base include Rails.app.url_helpers def as_json {url: stuff_url(id)}

    end end
  60. class Stuff < ActiveRecord::Base end class StuffPresenter < Presenter def

    as_json {url: stuff_url(id)} end end
  61. class Stuff < ActiveRecord::Base include Rails.app.url_helpers def as_json {url: stuff_url(id)}

    end end
  62. class StuffController < AppContro def show render json: @stuff.as_json.merge({ url:

    stuff_url(@stuff) }) end end
  63. Skinny controllers, fat models

  64. Skinny controllers, fat models Skinny controllers, models that only have

    code related to their main purpose: persistance. Move other stuff out to non- ActiveRecord classes.
  65. Decoding Smelly Code

  66. Decoding Smelly Code 1. Hidden silo

  67. Decoding Smelly Code 1. Hidden silo 2. Developers ready for

    more nuance
  68. Decoding Smelly Code 1. Hidden silo 2. Developers ready for

    more nuance 2.1. Developers actually listen to me o.0
  69. Every piece of bad code is trying to tell you

    something. 2
  70. Fixing Problems

  71. None
  72. http://www.flickr.com/photos/juniorvelo/4490511204

  73. Fixing Problems • Pair programming

  74. Create opportunities for informal communication

  75. Use High-Bandwidth Communication http://www.flickr.com/photos/beglendc/434086133

  76. http://www.flickr.com/photos/malias/73169727

  77. Fixing Problems • Pair programming • Create opportunities for informal

    communication • Use high-bandwidth communication • Teach/learn/practice
  78. None
  79. Hack your team 3

  80. • Think about team dynamics • Use code smells to

    illuminate problems • Fix them! http://www.flickr.com/photos/uggboy/4066337480
  81. • Think about team dynamics • Use code smells to

    illuminate problems • Fix them! http://www.flickr.com/photos/uggboy/4066337480
  82. Thank you! Sarah Mei Pivotal Labs @sarahmei sarah@pivotallabs.com