3 ms·
TDD is one approach, and like most approaches when it comes to creative acts (writing, painting, whatever), different approaches are a fit for different people.
by akeefer 17y ago
TDD is one approach, and like most approaches when it comes to creative acts (writing, painting, whatever), different approaches are a fit for different people.
Tests are crucial to maintaining quality over the long term and to preserving your ability to refactor and change the code. How you arrive at those tests (test-first, test-last, test-randomly) is much more a matter of personal taste. Part of maturing as a programmer is learning what works best for you.
- russell 17y agoI use a mixture. If it's a Java method, I use test-after, by which I mean after the method is written, some times after the core of the class. Most of the time I am not working from specs, so I find TDD interrupts the design/implementation flow. Often I dont know the complete signature until I have written it. If the method is complex, it often gets a couple of refactorings along the way. The case where I consistently test before is a method doing database queries. I find it much less tedious to write and test pure SQL before any java.
- stcredzero 17y agoSQL has a lot of parallels to dynamic languages like Smalltalk. Both have strange loops. SQL tables have their meta-data stored in yet another SQL table. (System dictionary.) All Smalltalk objects have their behavior stored in another object, its class. The class of any class is Class. Class also has a class, named Metaclass. The class of Metaclass is itself.