This is the place where I gather my knowledge about test driven development & clean code and write about my journey.
so, tdd at first seems very different.
coming from ‘not writing tests’ to ‘writing tests that work - after shipping features’ and now to ‘write tests before actually writing code’
started off with reading the book called clean code first - it introduces the concept of TDD to me - chapter 9 it is. main things highlighted:
- rules of TDD:
- first law: you may not write production code until you have written a failing unit test.
- second law: you may not write more of a unit test than is sufficient to fail, and not compiling is failing.
- third law: you may not write more production code than is sufficient to pass the currently failing test
- author emphasises on the fact that test code is as important as the production code - and keeping that in mind - test code should be super clean too.
- acronym used by the author - FIRST (tests should be Fast, Independent, Repeatable (in any env), Self-validating and timely.
Watched this video by fireship - where he implements a basic stack and introduces TDD. I was going to write a scraper using Typescript - and was doing it using TDD.
Next,
I got a little confused - I didn’t know how to start. There’s this community on discord by svs - and it had a channel called #programming-help. I started a discussion about how to do it.
General consensus was not to start learning TDD with a scraper. Rather pick up something logic heavy.
Some of the resources people suggested - are linked below.
I started off with one of the resources: learn-tdd
Repositories:
Books:
- Test-Driven Development by Example by Kent Beck
Videos: