TEST DRIVEN
DESIGN
LEMi ORHAN ERGiN
software craftsman @ acm
Slide 2
Slide 2 text
LEMi ORHAN ERGiN
agile software craftsman @ acm
/lemiorhan
lemiorhanergin.com
@lemiorhan
managing partner at acm
developing since 2001
worked at Sony and eBay/GittiGidiyor
consultant, architect, trainer, developer
founder of Software Craftsmanship Turkey
ex product owner of Agile Turkey Summit
meetup.scturkey.org
summit.agileturkey.org
Slide 3
Slide 3 text
Jack W. Reeves
The C++ Journal Vol. 2, No. 2. 1992
http://user.it.uu.se/~carle/softcraft/notes/Reeve_SourceCodeIsTheDesign.pdf
What is So!ware Design?
Slide 4
Slide 4 text
Source code is the real
so!ware design
Designing so!ware is an exercise in managing complexity
Jack W. Reeves
What is Software Design? The C++ Journal Vol. 2, No. 2. 1992
http://user.it.uu.se/~carle/softcraft/notes/Reeve_SourceCodeIsTheDesign.pdf
Slide 5
Slide 5 text
The so!ware design is
not complete until it has
been coded and tested
Testing is part of the process of refining the design
Jack W. Reeves
What is Software Design? The C++ Journal Vol. 2, No. 2. 1992
http://user.it.uu.se/~carle/softcraft/notes/Reeve_SourceCodeIsTheDesign.pdf
Slide 6
Slide 6 text
Programming
Source Code
SOFTWARE DESIGN
Test and
Verification
Slide 7
Slide 7 text
The very first value of
so!ware is…
Robert C. Martin
Author of Clean Code and Clean Coder
Owner of cleancoders.com training site
Slide 8
Slide 8 text
The very first value of
so!ware is to tolerate and
facilitate on-going changes
Robert C. Martin
Author of Clean Code and Clean Coder
Owner of cleancoders.com training site
Slide 9
Slide 9 text
Each city has to be renewed in order to
meet the needs of its populace.
So!ware-intensive systems are like that.
Grady Booch
Developed UML
Wrote foreword to
“Design Patterns” and
“Technical Debt” books
Istanbul, Turkey
Credit: European Space Imaging
Slide 10
Slide 10 text
Programming
Source Code
SOFTWARE DESIGN
Refactoring
Test and
Verification
Slide 11
Slide 11 text
Everything is part of the
design process
Jack W. Reeves
What is Software Design? The C++ Journal Vol. 2, No. 2. 1992
http://user.it.uu.se/~carle/softcraft/notes/Reeve_SourceCodeIsTheDesign.pdf
Slide 12
Slide 12 text
but…
we develop
without
driving
the design
Slide 13
Slide 13 text
nebula
concepts and terminology trigger ideas about the design
what we really do in general…
Slide 14
Slide 14 text
proto-star
initial classes containing the logic
simple structure, basic domain model and behaviors
Slide 15
Slide 15 text
brown dwarf
basic dependencies, works as we expect
utility classes start to occur
Slide 16
Slide 16 text
main sequence star
needless complexity starts, a lot of inter-dependencies
manual testing starts to take longer time than usual
Slide 17
Slide 17 text
hard to add new features
too much debugging
too many workarounds
too complex to know every flow
red giant
Slide 18
Slide 18 text
blue-white
super giant
single change affects many areas,
no reuse - duplication hell,
fragile system - unstable prod
scary refactoring,
silos occur
Slide 19
Slide 19 text
red super giant
huge classes, tons of workarounds,
no new features, maintenance mode rules,
basic implementations take weeks,
no one knows how overall system works,
rollbacks a!er deployments,
architect saves the company
black hole
deadly loop of total rewrite or exit from the market
Slide 24
Slide 24 text
Programming
Source Code
SOFTWARE DESIGN
Refactoring
Test and
Verification
Slide 25
Slide 25 text
Programming
Source Code
SOFTWARE DESIGN
Refactoring
good?
Test and
Verification
Slide 26
Slide 26 text
COUPLING
When readfile() is changed, do you change writeFile() too?
It shows how many places we need to change
Slide 27
Slide 27 text
Two elements are loosely
coupled if they are not
shown in the same diff
Kent Beck
The creator of extreme programming
One of the signatories of the Agile Manifesto
Pioneered software design patterns and TDD
Slide 28
Slide 28 text
COHESION
Do you search a lot where to change?
It shows how easy to find the places we need to change
Slide 29
Slide 29 text
How many files at any
one time is still open for
edit shows the level of
cohesion
Nat Pryce
Co-Author of Growing Object-Oriented Software Guided by Tests
Early adopter of XP
Slide 30
Slide 30 text
Programming
Source Code
SOFTWARE DESIGN
Refactoring
Low Coupling
Test and
Verification
High Cohesion
Slide 31
Slide 31 text
Programming
Source Code
SOFTWARE DESIGN
Refactoring
is hard and needs discipline!
Test and
Verification
High Cohesion
Low Coupling
Slide 32
Slide 32 text
Programming
Source Code
Test and
Verification
SOFTWARE DESIGN
Refactoring
Test Driven
High Cohesion
Low Coupling
Slide 33
Slide 33 text
Programming
Source Code
Test and
Verification
SOFTWARE DESIGN
Refactoring
Test Driven
High Cohesion
Low Coupling
Slide 34
Slide 34 text
Programming
Source Code
Test and
Verification
SOFTWARE DESIGN
Refactoring
Test Driven
High Cohesion
Low Coupling
Slide 35
Slide 35 text
Programming
Source Code
Test and
Verification
SOFTWARE DESIGN
Refactoring
Test Driven
High Cohesion
Low Coupling
Slide 36
Slide 36 text
Programming
Source Code
Test and
Verification
SOFTWARE DESIGN
Refactoring
Test Driven
High Cohesion
Low Coupling
Slide 37
Slide 37 text
Programming
Source Code
Test and
Verification
SOFTWARE DESIGN
Refactoring
Test Driven
High Cohesion
Low Coupling
Slide 38
Slide 38 text
Programming
Source Code
Test and
Verification
SOFTWARE DESIGN
Refactoring
Test Driven
High Cohesion
Low Coupling
Slide 39
Slide 39 text
Programming
Source Code
Test and
Verification
SOFTWARE DESIGN
Refactoring
Test Driven
High Cohesion
Low Coupling
Slide 40
Slide 40 text
Unit testing frameworks
Mocking frameworks
Automated testing types
Design principles
Refactoring techniques
Clean code principles
LEARN
Continuous Integration
Source code versioning
Notification mechanism
Code coverage monitoring
Practice TDD via katas
Develop via TDD
Acceptance testing via TDD
Verify by behaviours via BDD
ESTABLISH
PERFORM
Slide 41
Slide 41 text
Unit testing frameworks
Mocking frameworks
Automated testing types
Design principles
Refactoring techniques
Clean code principles
LEARN
Continuous Integration
Source code versioning
Notification mechanism
Code coverage monitoring
Practice TDD via katas
Develop via TDD
Acceptance testing via TDD
Verify by behaviours via BDD
ESTABLISH
PERFORM
Slide 42
Slide 42 text
Unit testing frameworks
Mocking frameworks
Automated testing types
Design principles
Refactoring techniques
Clean code principles
LEARN
Continuous Integration
Source code versioning
Notification mechanism
Code coverage monitoring
Practice TDD via katas
Develop via TDD
Acceptance testing via TDD
Verify by behaviours via BDD
ESTABLISH
PERFORM
Slide 43
Slide 43 text
Unit testing frameworks
Mocking frameworks
Automated testing types
Design principles
Refactoring techniques
Clean code principles
LEARN
Continuous Integration
Source code versioning
Notification mechanism
Code coverage monitoring
Practice TDD via katas
Develop via TDD
Acceptance testing via TDD
Verify by behaviours via BDD
ESTABLISH
PERFORM
Slide 44
Slide 44 text
small set of entities
few lines in methods
follows OOP design guidelines
simple design, names are the intensions
marbles
Slide 45
Slide 45 text
If you really want to see something interesting:)
ursa minor
and polaris