Jean-Paul Calderone <[EMAIL PROTECTED]> writes: > 1) Write unit tests for your code. Keep writing unit tests until > you have some that _don't pass_. Then fix your code so that they > do. When you do further development, write the tests first, then > implement the code that makes them pass.
Hear hear. Be advised, though, that attempting to apply unit tests to code that wasn't designed with testing in mind may very quickly reveal a poor design. [0] If you can't easily test pieces of the code independently, you probably haven't written those pieces to be loosely coupled and well-defined. The moral? Writing unit tests *along with* the functional code will result in a design that is loosely coupled, and probably better-defined. Also, hopefully, easy to test :-) [0] I have no idea whether this is the case for the OP. It's a very common symptom that arises from people who are first advised to introduce tests to their code, though. -- \ "If you ever catch on fire, try to avoid seeing yourself in the | `\ mirror, because I bet that's what REALLY throws you into a | _o__) panic." -- Jack Handey | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list