Test Driven Development and Refactoring
A 2-3 day course in which students will learn the fundamental skills of Test Driven Development and Refactoring.
Audience:
- Programmers of all levels of experience who desire to improve their coding skills._
Duration:
- The two day version is weighted towards lecture and demonstration with a minimum of exercises.
- The three day version shifts the weight towards in-class practice and exercises, withoutdiminishing the lectures and demonstrations.
Outcomes
After this class students will:
- ...understand how, when, and when not to refactor code.
- ...be able to refactor functions and classes into cleaner, more understandable forms.
- ...know, and be able to execute the three laws of Test Driven Development.
- ...be able to create test suites that enable refactoring.
- ...understand the basics of mocking and test-doubling in order to test theinterplay between components.
- ...be able to properly organize robust test suites.
- ...understand, and be able to employ, the strategy for testing and refactoring legacy code.
Outline
- Why TDD
- The Three Laws.
- The Benefits
- Reduced Debugging.
- Tests and Documents
- Design Improvement
- Refactoring.
- TDD is Double Entry Bookkeeping.
- Simple Demonstration of the three laws.
- Test Design
- Decoupling Tests and Production Code.
- Fragile Tests
- The Specific/Generic Dichotomy.
- The Transformation Priority Premise.
- Mocks and Test Doubles
- Dummies
- Stubs
- Spies
- Mocks
- Fakes
- Architecture and Tests
- Statism vs Mockism
- The TDD Uncertainty Principle
- Testing across architectural boundaries.
- **Refactor
- Code Smells
- Remedial Refactorings
- The process of refactoring.
- How much is enough?
- Refactoring Demonstration
A long demonstration that integrates TDD and Refactoring.- Refactoring the Test.
- Refactoring the Code.
- The role of design.
- Comparison of Test vs Prodution design.
- Exercises.
Several coding exercises and demonstrations as time permits.