Claudio Altamura
Four
Design
Rules
Kent Becks Design Rules
• Passes the tests
• Reveals intention
• No duplication
• Fewest elements
Slide 4
Slide 4 text
Claudio Altamura
Four
Design
Rules
What's so special about it?
• easy to remember
• improves code in every language
• helps to keep the design simple
• leads to a good design
Slide 5
Slide 5 text
Claudio Altamura
Four
Design
Rules
What is a good design?
• high cohesive
• loosely coupled
• expressive names
Slide 6
Slide 6 text
Claudio Altamura
Four
Design
Rules
Passes the Tests
• the code must work
• tests help to communicate the design
• tests make refactoring safe
Slide 7
Slide 7 text
Claudio Altamura
Four
Design
Rules
Reveals Intention
• code as easy as possible
• expresses every idea
• meaningful names
• brings clarity
• maximizes cohesion
Slide 8
Slide 8 text
Claudio Altamura
Four
Design
Rules
No Duplication
• DRY
• SPOT
• everything should be said once
• leads to a good design
• minimize coupling
Slide 9
Slide 9 text
Claudio Altamura
Four
Design
Rules
Fewest Elements
• what is not useful should be removed
• fewest possible classes and methods
• don't add code for future requirements
• complexity makes code harder to modify
Slide 10
Slide 10 text
Claudio Altamura
Four
Design
Rules
Priority
Reveals Intention
Priority
No Duplication
Passes the Tests
Fewest Elements
Slide 11
Slide 11 text
Claudio Altamura
Four
Design
Rules
Intention vs Duplication
• doesn't matter which comes first
• both rules help to redefine the code
• these rules lead to a simple design
• most problems are naming problems