Hacker News new | ask | show | jobs
by cgopalan 4486 days ago
Just read the essay. Very informative. It basically lays down most of what I think about TDD, except that IMO, writing some tests first (which I know about) is better than writing tests last.

But thats exactly my point. The workflow for solving a problem and making sure its sufficiently correct cannot be pinned down to something as simple as red-green-refactor. Programmers have to be given the flexibility to approach problem-solving in different ways. As long as the program is correct and performs as stipulated by requirements (both functional and non-functional) it doesnt matter how it was arrived at.

Eagerly awaiting your follow-up writeup. And if you do hear of some open-source projects that have used TDD successfully, please mention them.

My goal in asking this question on HN is to have an open mind about TDD and learn to do it well. But I dont want to add that skill if it has not proven to be successful. IMO, there are lots of other skills that I could add to my toolbox that I think are more useful as a programmer.

1 comments

That's a rather small "except", as I wrote "My own practice is to have good, automated tests, but these don't get put into place until the cost/benefit ratio makes the tests worthwhile; which is rarely at the start of the code development and always by the end." The difference between you and me is "some tests first" vs. "rarely do tests come first."

The useful skill I think should be practiced more often is of breaking code. Take a code base and find out where it doesn't scale, where it core dumps, where it sits in an infinite loop, or where it lets you write read and write arbitrary files to the file system.

It's pretty fun, but it's a mindset contrary to that of most programmers, who are optimistic and goal oriented, rather than pessimistic and defensive like me.

In my essay I'll ask for pointers to public projects developed in full red-green-refactor style.

Cheers.