Simplicity

466 views

Published on

Building working software is hard. But it's so much harder to build software that is easy to change. Yet this is a prerequisite for being truly agile, and a key enabler of agility is simplicity. But what exactly does simplicity mean and why is it so hard to achieve? It looks like complexity creeps in as soon as you stop paying attention, and most of it is accidental. Luckily, there are practical ways to get to simplicity by following good design principles and choosing simpler tools.

Published in: Software
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
466
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
13
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Simplicity

  1. 1. simplicity 0.3 Osvaldas Grigas o.grigas@gmail.com
  2. 2. complexity 0.3 Osvaldas Grigas o.grigas@gmail.com
  3. 3. inspired by Dan North Rich Hickey J.B. Rainsberger Michael Feathers
  4. 4. Edsger Dijkstra (1980) Computing's central challenge, "How not to make a mess of it", has not been met.
  5. 5. agile
  6. 6. agile continuous improvement based on frequent feedback
  7. 7. iterative development
  8. 8. incremental development
  9. 9. DONE
  10. 10. embrace the transient nature of your code
  11. 11. Russ Miles Complexity is the silent killer of delivering change at the right time.
  12. 12. simplicity is prerequisite for agility
  13. 13. what is simplicity ?
  14. 14. Nothing is more simple than a single giant button MacBook Wheel
  15. 15. what "simple" isn’t ...
  16. 16. what "simple" isn’t ... familiar / convenient
  17. 17. what "simple" isn’t ... familiar / convenient small / concise
  18. 18. what "simple" isn’t ... familiar / convenient small / concise beautiful / elegant
  19. 19. “Simplicity -- the art of maximizing the amount of work not done -- is essential.” from the agile principles
  20. 20. YAGNI from the agile principles “Simplicity -- the art of maximizing the amount of work not done -- is essential.”
  21. 21. “Technical excellence and good design enhances agility.” from the agile principles
  22. 22. Martin Fowler Design is there to enable you to keep changing the software easily.
  23. 23. when it comes to design ...
  24. 24. COMPLEXITY SUCKS SIMPLICITY RULES
  25. 25. COMPLEXITY SUCKS ...
  26. 26. COMPLEXITY SUCKS ... … your brain power
  27. 27. COMPLEXITY SUCKS ... … your brain power
  28. 28. Rich Hickey Once your software is of a certain size, complexity is gonna dominate what you can do.
  29. 29. essential complexity
  30. 30. essential complexity your code
  31. 31. essential complexity your codelibraries frameworks
  32. 32. essential complexity language runtime your codelibraries frameworks
  33. 33. accidental complexity essential complexity
  34. 34. SIMPLICITY RULES ...
  35. 35. SIMPLICITY RULES ... … are …
  36. 36. SIMPLICITY RULES ... … are … The 4 Rules of Simple Design
  37. 37. SIMPLICITY RULES ... … are … The 4 Rules of Simple Design 1) passes all tests
  38. 38. SIMPLICITY RULES ... … are … The 4 Rules of Simple Design 1) passes all tests 2) clear, expressive names
  39. 39. SIMPLICITY RULES ... … are … The 4 Rules of Simple Design 1) passes all tests 2) clear, expressive names 3) no duplication
  40. 40. SIMPLICITY RULES ... … are … The 4 Rules of Simple Design 1) passes all tests 2) clear, expressive names 3) no duplication 4) minimal
  41. 41. rule #4: minimal
  42. 42. the less code, the better
  43. 43. code folding
  44. 44. code generators
  45. 45. dependency managers
  46. 46. stop typing. think!
  47. 47. test-first (TDD / BDD)
  48. 48. rule #3: no duplication
  49. 49. primitive obsession duplication in behavior
  50. 50. data clump duplication in structure
  51. 51. refactoring
  52. 52. rule #2: clear, expressive names
  53. 53. small, focused methods reduce cyclomatic complexity
  54. 54. small, focused classes single responsibility
  55. 55. AccountService AccountManager AccountHandler AccountUtils AccountHelper AccountImpl AccountData AccountDTO AccountInfo AccountDetails AccountObject AbstractAccount BaseAccount CustomAccount SimpleAccount
  56. 56. refactoring
  57. 57. rule #1: passes all tests
  58. 58. unit testing
  59. 59. testability & good design
  60. 60. testability & good design (but not integration tests)
  61. 61. inheritance-based design
  62. 62. wget -qO- http://c2.com/ | tr -cs '[:alpha:]' 'n' | sort | uniq composition
  63. 63. dependencies
  64. 64. auto-import
  65. 65. refactoring tools
  66. 66. A G F D C introduce indirection
  67. 67. A B E G F D C introduce indirection
  68. 68. A B E G F D C follow the law of Demeter introduce indirection
  69. 69. modularity
  70. 70. coupling
  71. 71. add an interface?
  72. 72. layered architectures
  73. 73. add remoting? SOAP
  74. 74. enterprise grade decoupling? ESB
  75. 75. enterprise grade decoupling? ESB assumptions assumptions
  76. 76. interface segregation
  77. 77. tell, don’t ask high cohesion
  78. 78. dependency inversion role
  79. 79. anti-corruption layer adapter role
  80. 80. notify Payment Order Auditor Financial Event Listener Mongo Audit Trail log Audit Trail Mongo Audit Records insert
  81. 81. Payment Order Audit DAO Audit DAO Impl insert
  82. 82. further decoupling queue publish subscribe
  83. 83. use cases & business rules framework persistence framework web DB infrastructure messaging QUEUE task scheduler WS
  84. 84. Domain Logic Framework Framework
  85. 85. Domain Logic Domain Logic Framework Framework accidental complexity complexity leak
  86. 86. @Entity @Table(name = "orders", schema = "com"}) public class Order implements Serializable { @Id @GeneratedValue(strategy = SEQUENCE, generator = "order_seq") @Column(name = "ID", unique = true, nullable = false) private Integer id; @Column(name = "NUMBER", nullable = false, length = 8) private String number; @ManyToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL) @JoinTable(name = "order_items", catalog = "com", joinColumns = {@JoinColumn(name = "ORDER_ID", updatable = false, nullable = false)}, inverseJoinColumns = {@JoinColumn(name = "ITEM_ID", updatable = false, nullable = false)}) private Set<Item> items = new HashSet<Item>(); }
  87. 87. the law of leaky abstractions
  88. 88. home-grown frameworks
  89. 89. libraries
  90. 90. state & side effects
  91. 91. values & pure functions
  92. 92. functional style imperative style
  93. 93. functional style expressions imperative style statements
  94. 94. functional style expressions immutable values imperative style statements mutable state
  95. 95. functional style expressions immutable values data transformations imperative style statements mutable state side effects
  96. 96. functional style expressions immutable values data transformations recursion & polymorphism imperative style statements mutable state side effects looping & branching
  97. 97. stepping out of comfort zone
  98. 98. Edsger Dijkstra (1980) Computing's central challenge, "How not to make a mess of it", has not been met.
  99. 99. I‘m done

×