▶️

Grep YouTube Playlist notes

Video 1 notes and learnings

In this video, we try to write the first test and basic implementation. We will go through the whole Red - Green - Refactor cycle.
Lessons from this video:
  • Test naming conventions: use the name that will give you enough context when the test fails on CI system
  • Example based tests in Golang and how to use them
  • Given, When, and Then way to write test cases
  • Start with the "when", figure out the API contract for your code
  • When you're done writing a test case, check whether the test fails for the right reason
  • Write just enough implementation to make the test pass
  • Refactor

Video 2 notes and learnings

We explore possible options for testing input from STDIN. Along the way, we learn to identify the nature of the problem we are dealing with (filtering, scatter gather, etc.)
Lessons from this video:
  • How to write table driven tests in Golang
  • Ways to write happy and error scenarios in test cases
  • functional core and imperative shell
  • How to identify the core of the problem

Video 3 notes and learnings

In this video, we write table driven tests in Golang and we explore possible options for testing input from STDIN.
Lessons from this video:
  • How to write table driven tests in Golang
  • Ways to write happy and error scenarios in test cases
  • functional core and imperative shell
  • How to identify the core of the problem

Video 4 notes and learnings

Duplication of code is not usually the main problem, it's just a symptom, the real problem is bad abstractions.
If you want to understand this concept in depth then you should watch this video about Learning to build applications in Go using Test Driven Development.
Lessons from this (rather long) video:
  • How to test STDIN via automated unit tests
  • How to refactor code during TDD cycle
  • How to observe the tests to get feedback about design
  • How to design to interfaces and not to concrete implementation

Video 5 notes and learnings

Writing tests first using TDD makes you think harder about the problem. TDD (almost) forces you to spend more time thinking about the problem and possible interfaces than just hacking together some code with bad design.
In this video, we don't write any line of actual working code, but we brainstorm multiple approaches in designing the right interfaces.
Lessons from this video:
  • Streaming vs micro-batching approach and their trade-offs in API design
  • How to think about using Goroutines and Channels
  • How to write recursive functions in Go
  • Designing minimal test data for simulating all cases for a problem statement

Video 6 notes and learnings

In part 6 of the Build applications in Golang using Test Driven Development, we design and implement functionality to grep through the entire directory recursively.
Lessons from this video:
  • Value as a boundary: how to identify structs for returning data across functions
  • Make it work, make it better, in that order: How to break the problem such that we implement a working version first and then improve it later instead of approaching both these problems together
  • Understand filepath.walkDir in Go and how it works
  • Handling filepaths that are compatible across operating systems
  • How to capture error as a value

Video 7 notes and learnings

In part 7 of the Build applications in Go using Test Driven Development, we write more test cases for recursive grepping functionality.
Lessons from this video:
  • Understand the challenges with opening and closing files in a for loop
  • Treat the test code as production code.
  • How to manage test case duplication
  • Returning results from a function in streaming fashion or in bulk fashion
  • Identify core from the presentation. TDD helps you focus on the core than just presentation.
  • Tests are live documentation so we need to ensure test code is readable and maintainable

Video 8 notes and learnings

In part 8 of the Build applications in Go using Test Driven Development, we use goroutines, channels, and wait groups to recursively grep into files.
If you always wanted to know how goroutines and channels are used in practice to solve some real world problem, this video is for you!
Lessons from this video:
  • How to use Goroutines, channels and wait groups
  • How to "return" values from goroutines (using channels)
  • Refactoring concurrent code that uses goroutines
  • What are done channels, why are these needed and how these are used
  • Good old learnings about variable, method and struct naming conventions and best practices

Final video notes and learnings

In this final part of the Build applications in Go using Test Driven Development, we summarise our learning from all previous videos. Make sure to watch this video to see how we evolved the solution using TDD.