Re:The “Build Your Own Redis” Book Is Completed
by dcuthbertson on Monday January 30, 2023 @06:27AM
(#34578395)
A long time ago I found the chicken and egg problem to be more general than TDD. It was more along the lines of, "how do you write a program when you don't have the code (subroutines, other functions) it needs to run?" Where do you start - at main() or say, opening a file that doesn't yet exist to read/write some data? It was always a struggle.
Then I found Structure and Interpretation of Computer Programs (SICP)[0] and the video lectures from MIT[1]. I had an epiphany when Sussman talked about "wishful thinking" in video for lecture 1b[0] (around 48:00 in). The lesson was something along the lines of start naming functions that would do what you needed done, and write them later. Just pretend they exist and eventually bring them into existence. SICP has so many gems. It really made a difference for me.
If applied to TDD, write a test that won't even compile because the function under test doesn't even exist. Then iterate by writing something that compiles, but will probably fail, and then improve it until the test passes.
Then I found Structure and Interpretation of Computer Programs (SICP)[0] and the video lectures from MIT[1]. I had an epiphany when Sussman talked about "wishful thinking" in video for lecture 1b[0] (around 48:00 in). The lesson was something along the lines of start naming functions that would do what you needed done, and write them later. Just pretend they exist and eventually bring them into existence. SICP has so many gems. It really made a difference for me.
If applied to TDD, write a test that won't even compile because the function under test doesn't even exist. Then iterate by writing something that compiles, but will probably fail, and then improve it until the test passes.
[0]: https://mitp-content-server.mit.edu/books/content/sectbyfn/b...
[1]: https://ocw.mit.edu/courses/6-001-structure-and-interpretati...
[2]: https://www.youtube.com/watch?v=V_7mmwpgJHU&t=2s