The document discusses three software design principles: incremental design, single responsibility, and dependency inversion. Incremental design means making small iterative changes, refactoring often, and learning about problems along the way. Single responsibility refers to classes having only one reason to change and avoiding mixing responsibilities. Dependency inversion means depending on abstractions rather than concrete implementations through interfaces.
2. About Me
Tech Lead at Cyrus Innovation
Passionate about Agile and XP
Pairing
TDD
Incremental Design
Contact Me
@mdenomy on Twitter and GitHub
http://mdenomy.wordpress.com/
Sunday, September 22, 13
3. SOLID Design Principles
Set of principles identified by Bob
Martin, aka Uncle Bob
- Somewhere in the 1995-2000 timeframe
- Uncle Bob has some strong opinions on
software, you should check them out
Sunday, September 22, 13
4. SOLID Design Principles
S Single Responsibility
O Open-Closed
L Liskov Substitution
I Interface Segregation
D Dependency Inversion
not Dependency Injection
Sunday, September 22, 13
5. SOLID Design Principles
S Single Responsibility
D Dependency Inversion
not Dependency Injection
That’s plenty for today
Sunday, September 22, 13
6. Single Responsibility
Official Definition
- A class should have only one reason to
change
What It Means To You
- Keep your classes small
- Don’t mix responsibilities
- CheckingAccount manages balance and
calculates fees
Sunday, September 22, 13
7. Dependency Inversion
Official Definition
- Depend on abstractions not concretions
What It Means To You
- Your class should not know the details of its
dependencies, just the interfaces
- Ideally both ends of the dependency
relationship deal with abstractions, i.e.
interfaces
- Dependency injection is a way to implement
dependency inversion
Sunday, September 22, 13
8. Incremental Design
Always Be Designing
Pay attention to “code smells”
The simplest thing that works
Red-Green-Refactor
not Red-Green-Red-Green-Red-Green
-Refactor-Refactor-Refactor-Refactor-Refactor
You will never know less than you
know now
- Sandi Metz, Practical OOD in Ruby (POODR)
Sunday, September 22, 13
9. Let’s Look at Some Code
Really Simple Example of a
CheckingAccount
Work in small increments
Learn about the problem as we go
Listen for code smells
https://github.com/mdenomy/intro-design-workshop
Note:Readme contains design thoughts as I go
Sunday, September 22, 13
10. Take-Aways
Work small
Pay attention to design trade-offs,
technical debt, and naming
Be students of your craft
Processes, frameworks, tools, everything
Challenge your assumptions
Just cause it’s the “right” way today...
Sunday, September 22, 13
11. References
Bob Martin (Uncle Bob) on SOLID
http://butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod
Sandi Metz - SOLID Talk at
GORUCO
http://www.confreaks.com/videos/240-goruco2009-solid-object-
oriented-design
Derick Bailey - Los Techies
http://lostechies.com/derickbailey/2011/09/22/dependency-injection-
is-not-the-same-as-the-dependency-inversion-principle/
James Shore - Art of Agile
http://www.jamesshore.com/Agile-Book/incremental_design.html
Sunday, September 22, 13