by nybblesio · 6y ago · 0 comments
What's under test is the design. Way before TDD was a thing, when I worked at IBM, we used to call this "inverted design": write the calling code first to see what the API might look like and then make it work. In the late 80s it would have been considered a massive waste to assert behavior though; we'd just implement it.
Automated functional tests (from the outside in) are where the bulk of does-it-do-what-it-says-on-the-tin testing should happen.
I really like the idea of this, and I very occasionally have the foresight and wherewithal to do this kind of "top-down" programming.
Maybe not surprisingly, this is how I sometimes end up with the much-criticized "Interface with only one implementer" design smell. I write the interfaces that I would like, right next to where I'm writing the calling code. The interface(s) evolve as the calling code is unfolding. Then, later, I make an impl for the Interface.
At that point I could just delete the interface and only use the concrete implementation, but... I don't. shrug.
https://ronjeffries.com/xprog/articles/oksudoku/
https://ronjeffries.com/xprog/articles/sudoku2/
https://ronjeffries.com/xprog/articles/sudokumusings/
https://ronjeffries.com/xprog/articles/sudoku4/
https://ronjeffries.com/xprog/articles/sudoku5/