|
|
|
|
|
by joeyguerra
1385 days ago
|
|
TDD is hard when you don't know what your goal is. But it's easy to "just start executing code". I leverage it to get into an exploratory mode in order to think through my designs. How I TDD
1. create a file with a test.
2. Get it running continuously (dotnet watch test or mocha --watch)
3. Write the code in the same file (just to start the design) as the test so I don't have to bounce around
4. Iterate at step 3 for a while to explore the core domain/model/data (in your example, a Transaction has an amount, a payee, and time for instance), just to reach "escape velocity"
5. Ruthlessly push out dependencies that cross boundaries (file system, network, etc), protecting the core
6. Practice Red-Green-Refactor technique (write a failing/not compiling test, make it pass, refactor)
7. Red-Green phase, I just make things work
8. Refactor phase, I design, reflect on object/function communication patterns Designing architecture is not easy. And keeping it simple, even less. So I've spent time learning about design patterns, boundaries, and communication patterns and implications to improve my design skills. |
|