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

Is Your Code Too SOLID?

Is Your Code Too SOLID?

This version does NOT include a talk transcript; version with transcript is here:
https://speakerdeck.com/sarahmei/is-your-code-too-solid-with-transcript

SOLID is a collection of five common object-oriented development principles collected into one handy acronym. Smart people recommend learning about it, and even the name sounds fantastic — who doesn’t want to write “solid” code? Clearly, you should strive to follow all five principles, all the time, in all of your code. Right? Well. Good object-oriented design is indeed helpful, but SOLID as a set of guiding principles really isn’t. Let’s break SOLID down and reveal the limitations of our current approach, and try to understand just how SOLID our code needs to be.

sarahmei

July 23, 2015
Tweet

More Decks by sarahmei

Other Decks in Technology

Transcript

  1. S A R A H M E I W D

    C N Z 2 0 1 5 I S Y O U R C O D E TO O S O L I D ? https://www.flickr.com/photos/pie4dan/4567311801
  2. DevMynd S A R A H M E I C

    H I E F C O N S U LTA N T D E V M Y N D U N I T E D S TAT E S C H I E F O F BA L D E A G L E S A N D F R E E D O M http://world-map1.org/map1520769_0_0.htm http://www.coolholidaygraphics.com/flagday/glittergraphics/flagdayglitter2.gif https://www.devmynd.com/images/team/sarah-mei-cutout.png
  3. C O D E BA S E S I WO

    R K O N N O R M A L C O D E BA S E S https://www.flickr.com/photos/pmarkham/5361277692
  4. DevMynd S A N D I M E T Z

    E X P E RT AT E V E RY T H I N G S E R I O U S LY, G E T I T A M A Z I N G B O O K http://www.sandimetz.com/ http://www.poodr.com/
  5. DevMynd S A N D I M E T Z

    E X P E RT AT E V E RY T H I N G S E R I O U S LY, G E T I T A M A Z I N G B O O K http://www.sandimetz.com/ http://www.poodr.com/
  6. D E S I G N D E C I

    D I N G H OW TO A R R A N G E C O D E https://www.flickr.com/photos/matley0/3616669592
  7. D E S I G N D E C I

    D I N G H OW TO A R R A N G E C O D E https://www.flickr.com/photos/matley0/3616669592
  8. O B J E C T- O R I E

    N T E D D E S I G N G R O U P I N G R E L AT E D F U N C T I O N A L I T Y I N O B J E C T S https://www.flickr.com/photos/mwanasimba/2901201955/
  9. DevMynd A L A N G UA G E F

    E AT U R E A WAY O F T H I N K I N G O B J E C T- O R I E N T E D D E S I G N I S https://www.flickr.com/photos/56627607@N05/15635620289/
  10. DevMynd A L A N G UA G E F

    E AT U R E A WAY O F T H I N K I N G O B J E C T- O R I E N T E D D E S I G N I S A D E S T I N AT I O N A M E A N S TO A N E N D https://www.flickr.com/photos/56627607@N05/15635620289/
  11. H I G H L OW H I G H

    L OW C O S T O F U N D E R S TA N D I N G C O S T O F C H A N G E
  12. H I G H L OW H I G H

    L OW C O S T O F U N D E R S TA N D I N G C O S T O F C H A N G E
  13. H I G H L OW H I G H

    L OW Procedures C O S T O F U N D E R S TA N D I N G C O S T O F C H A N G E
  14. H I G H L OW H I G H

    L OW Procedures C O S T O F U N D E R S TA N D I N G C O S T O F C H A N G E
  15. H I G H L OW H I G H

    L OW Procedures Set of Small Objects C O S T O F U N D E R S TA N D I N G C O S T O F C H A N G E
  16. H I G H L OW H I G H

    L OW Procedures ⚠⚡ Set of Small Objects C O S T O F U N D E R S TA N D I N G C O S T O F C H A N G E
  17. H I G H L OW H I G H

    L OW Procedures Set of Small Objects C O S T O F U N D E R S TA N D I N G C O S T O F C H A N G E Really big objects
  18. H I G H L OW H I G H

    L OW Procedures Set of Small Objects C O S T O F U N D E R S TA N D I N G C O S T O F C H A N G E Really big objects The wrong set of small objects
  19. H I G H L OW H I G H

    Procedures Set of Small Objects L OW C O S T O F U N D E R S TA N D I N G C O S T O F C H A N G E Really big objects The wrong set of small objects
  20. H I G H L OW H I G H

    Procedures Set of Small Objects L OW C O S T O F U N D E R S TA N D I N G C O S T O F C H A N G E Really big objects The wrong set of small objects
  21. O B S E R V E R N E

    W E M A I L User
  22. H I G H L OW H I G H

    L OW E A S I E R TO C H A N G E H A R D E R TO U N D E R S TA N D C O S T O F U N D E R S TA N D I N G C O S T O F C H A N G E
  23. N A M E S U M M A RY

    U T I L I T Y S O L I D
  24. S I N G L E R E S P

    O N S I B I L I T Y P R I N C I P L E S O L I D https://www.flickr.com/photos/shenamt/8582808329/
  25. N A M E S U M M A RY

    U T I L I T Y S S I N G L E R E S P O N S I B I L I T Y O N E R E S P O N S I B I L I T Y P E R C L A S S M E D O L I D
  26. N A M E S U M M A RY

    U T I L I T Y S S I N G L E R E S P O N S I B I L I T Y O N E R E S P O N S I B I L I T Y P E R C L A S S M E D O L I D
  27. O P E N / C L O S E

    D P R I N C I P L E S O L I D https://www.flickr.com/photos/28481088@N00/4063800774/
  28. N A M E S U M M A RY

    U T I L I T Y S S I N G L E R E S P O N S I B I L I T Y O N E R E S P O N S I B I L I T Y P E R C L A S S M E D O O P E N / C L O S E D D O N ’ T E D I T C O D E ; A D D N E W C O D E L O W L I D
  29. L I S KOV S U B S T I

    T U T I O N P R I N C I P L E S O L I D https://www.flickr.com/photos/vpickering/14416940341/
  30. DevMynd Let Φ(x) be a property provable about objects x

    of type T. Then Φ(y) should be true for objects y of type S where S is a subtype of T.
  31. L I S KOV S U B S T I

    T U T I O N P R I N C I P L E S O L I D https://www.flickr.com/photos/vpickering/14416940341/
  32. I T ’ S N E V E R TO

    O L AT E TO https://www.flickr.com/photos/wcouch/8578612563/
  33. N A M E S U M M A RY

    U T I L I T Y S S I N G L E R E S P O N S I B I L I T Y O N E R E S P O N S I B I L I T Y P E R C L A S S M E D O O P E N / C L O S E D D O N ’ T E D I T C O D E ; A D D N E W C O D E L O W L L I S K O V S U B S T I T U T I O N I N H E R I TA N C E . I T ’ S A T H I N G . L O W I D
  34. I N T E R FA C E S E

    G R E G AT I O N P R I N C I P L E S O L I D https://www.flickr.com/photos/66126733@N04/8477516123/i
  35. W H Y S E G R E G AT

    E I N T E R FA C E S ? Musician AlbumCreator recordSong editSong mixSong sellMerch playSetList Gig
  36. W H Y S E G R E G AT

    E I N T E R FA C E S ? Musician AlbumCreator recordSong editSong mixSong sellMerch playSetList Gig driveVan
  37. W H Y S E G R E G AT

    E I N T E R FA C E S ? StudioActions AlbumCreator recordSong editSong mixSong sellMerch playSetList Gig driveVan VenueActions
  38. N A M E S U M M A RY

    U T I L I T Y S S I N G L E R E S P O N S I B I L I T Y O N E R E S P O N S I B I L I T Y P E R C L A S S M E D O O P E N / C L O S E D D O N ’ T E D I T C O D E ; A D D N E W C O D E L O W L L I S K O V S U B S T I T U T I O N I N H E R I TA N C E . I T ’ S A T H I N G . L O W I I N T E R FA C E S E G R E G AT I O N M A K E T H E A P I S M A L L H I G H D
  39. D E P E N D E N C Y

    I N V E R S I O N P R I N C I P L E S O L I D https://www.flickr.com/photos/hansmaulwurf/13702053625/
  40. N A M E S U M M A RY

    U T I L I T Y S S I N G L E R E S P O N S I B I L I T Y O N E R E S P O N S I B I L I T Y P E R C L A S S M E D O O P E N / C L O S E D D O N ’ T E D I T C O D E ; A D D N E W C O D E L O W L L I S K O V S U B S T I T U T I O N I N H E R I TA N C E . I T ’ S A T H I N G . L O W I I N T E R FA C E S E G R E G AT I O N M A K E T H E A P I S M A L L H I G H D D E P E N D E N C Y I N V E R S I O N M O V E C H O I C E S T O E D G E S O F S Y S T E M H I G H
  41. N A M E S U M M A RY

    U T I L I T Y S S I N G L E R E S P O N S I B I L I T Y O N E R E S P O N S I B I L I T Y P E R C L A S S M E D O O P E N / C L O S E D D O N ’ T E D I T C O D E ; A D D N E W C O D E L O W L L I S K O V S U B S T I T U T I O N I N H E R I TA N C E . I T ’ S A T H I N G . L O W I I N T E R FA C E S E G R E G AT I O N M A K E T H E A P I S M A L L H I G H D D E P E N D E N C Y I N V E R S I O N M O V E C H O I C E S T O E D G E S O F S Y S T E M H I G H
  42. N A M E S U M M A RY

    U T I L I T Y S S I N G L E R E S P O N S I B I L I T Y O N E R E S P O N S I B I L I T Y P E R C L A S S M E D O O P E N / C L O S E D D O N ’ T E D I T C O D E ; A D D N E W C O D E L O W L L I S K O V S U B S T I T U T I O N I N H E R I TA N C E . I T ’ S A T H I N G . L O W I I N T E R FA C E S E G R E G AT I O N M A K E T H E A P I S M A L L H I G H D D E P E N D E N C Y I N V E R S I O N M O V E C H O I C E S T O E D G E S O F S Y S T E M H I G H
  43. S T R AT E G Y & TA C

    T I C S https://www.flickr.com/photos/teegardin/6150427712/
  44. \ O / \ O / \ O / G

    OA L : P R O M O U N TA I N E E R S T R AT E G Y: C L I M B T H I S M T N TA C T I C S : T H E R O U T E U P https://www.flickr.com/photos/frenchy/222016256/
  45. \ O / \ O / \ O / G

    OA L : P R O M O U N TA I N E E R S T R AT E G Y: C L I M B T H I S M T N TA C T I C S : T H E R O U T E U P 1 2 3 https://www.flickr.com/photos/frenchy/222016256/
  46. G OA L : P R O M O U

    N TA I N E E R S T R AT E G Y: C L I M B T H I S M T N TA C T I C S : T H E R O U T E U P \ O / https://www.flickr.com/photos/frenchy/222016256/
  47. G OA L : P R O M O U

    N TA I N E E R S T R AT E G Y: C L I M B T H I S M T N https://www.flickr.com/photos/frenchy/222016256/
  48. G OA L : C H A N G E

    A B L E S O F T WA R E S T R AT E G Y: TA C T I C S : O O D E S I G N S O L I D https://www.flickr.com/photos/sunfox/5084875405/
  49. G OA L : C H A N G E

    A B L E S O F T WA R E S T R AT E G Y: TA C T I C S : O O D E S I G N S O L I D https://www.flickr.com/photos/sunfox/5084875405/
  50. N A M E S U M M A RY

    U T I L I T Y S S I N G L E R E S P O N S I B I L I T Y O N E R E S P O N S I B I L I T Y P E R C L A S S M E D O O P E N / C L O S E D D O N ’ T E D I T C O D E ; A D D N E W C O D E L O W L L I S K O V S U B S T I T U T I O N I N H E R I TA N C E . I T ’ S A T H I N G . L O W I I N T E R FA C E S E G R E G AT I O N M A K E T H E A P I S M A L L H I G H D D E P E N D E N C Y I N V E R S I O N M O V E C H O I C E S T O E D G E S O F S Y S T E M H I G H
  51. G OA L : C H A N G E

    A B L E S O F T WA R E S T R AT E G Y: TA C T I C S : S O L I D P R I N C I P L E S https://www.flickr.com/photos/sunfox/5084875405/
  52. G OA L : C H A N G E

    A B L E S O F T WA R E S T R AT E G Y: TA C T I C S : S O L I D P R I N C I P L E S https://www.flickr.com/photos/sunfox/5084875405/
  53. G OA L : C H A N G E

    A B L E S O F T WA R E S T R AT E G Y: TA C T I C S : S O L I D P R I N C I P L E S https://www.flickr.com/photos/sunfox/5084875405/
  54. H I G H L OW H I G H

    L OW The wrong set of small objects ❗ C O S T O F U N D E R S TA N D I N G C O S T O F C H A N G E
  55. DevMynd T H E O N LY WAY TO M

    A K E A S TO P - T H E - WO R L D R E FA C TO R I N G WO R K I S TO N OT D O I T . http://www.imdb.com/title/tt0086567/
  56. S TA B L E S M E L L

    Y O U R C O D E https://www.flickr.com/photos/pedrosimoes7/169983321/
  57. T I N Y P R O B L E

    M S F I R S T S TA B L E https://www.flickr.com/photos/ian-arlett/13706787684/
  58. A U G M E N T T E S

    T S S TA B L E https://www.flickr.com/photos/horiavarlan/4273968004/
  59. S TA B L E BA C K U P

    https://www.flickr.com/photos/mjonasson/19228720295/
  60. S TA B L E L E AV E I

    T B E T T E R T H A N Y O U F O U N D I T https://www.flickr.com/photos/spierisf/6989462184/
  61. E X P E C T G O O D

    R E A S O N S S TA B L E https://www.flickr.com/photos/an_untrained_eye/5012331537
  62. S S M E L L Y O U R

    C O D E T T I N Y P R O B L E M S F I R S T A A U G M E N T T E S T S B B A C K U P L L E AV E I T B E T T E R E E X P E C T G O O D R E A S O N S
  63. S S M E L L Y O U R

    C O D E T T I N Y P R O B L E M S F I R S T A A U G M E N T T E S T S B B A C K U P L L E AV E I T B E T T E R E E X P E C T G O O D R E A S O N S