Hacker News new | ask | show | jobs
by sudhirj 607 days ago
Oh god this is such a nightmare. It takes much longer to build something that works not the first try, because then I have to force-simulate a mistake to make sure things were actually correct in the first place.

Test Driven Development had a fix for this, which I used to do back in day when I was evangelical about the one true way the write software. You wrote a test that failed, and added or wrote code only to make that test pass. Never add any code except to make a failing test pass.

It didn't guarantee 100% correct software, of course, but it prevented you from gaslighting yourself for being too awesome.

1 comments

Tests are like the burning sun in your eyes after you wake up for a night of drinking.

I prefer separating writing some code down, making it functionally work on screen and writing tests. I usually cover cases in step 2 but when you add sometime new later it is nice to have step 3.