Hi Sandi, thanks for doing this AMA. When you code, do you follow TDD religiously? I like to write tests, but have a hard time writing tests before functionality, so I tend to write tests after the fact. What downsides do you see to writing tests second?
Andrew, this is my pleasure.
Ah, TDD. I find my code turns out better if I write tests first, but I am deeply sympathetic about how hard that can be. Writing tests first can help drive you to create decoupled code. If you write tests 2nd, and then find that the tests have complicated setup, this suggests that your code is too tightly coupled together. If you write tests first, and insist on having simple setup, you'll naturally end up with nicely decoupled code.
That makes sense, thanks!
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.