written this on (or about) Thu, 17 Jul 2003 07:31:47 GMT, :
The code I'm starting to write using TDD is very nice in many ways. It's short,easy to read/modify, and does everything it's supposed to do. I can see,however, that is is woefully inefficient.If I try to think of this problem in incremental, TDD terms, efficiency maynever be a requirement, so I can safely ignore it for now. Eventually, anyrequirement needs a test, so I'm figuring an efficiency requirement wouldrequire a performance test.It seems to me that a performance test would be harder to deal with than apurely functional test. What if the speed and/or memory of my test system arewildly different than the the system it will run on, for instance?
Efficiency is almost never where you think it is. I'd advise against
thinking about it early. Instead, get all your other tests to pass,
and then write the efficiency test. If it doesn't pass then run a
profiler on the system and see where the time is going. (You'll
probably be quite surprised.) Attack the big CPU consumers one at a
time.
Robert C. Martin | "Uncle Bob"
Object Mentor Inc.| unclebob @ objectmentor . com
PO Box 5757 | Tel: (800) 338-6716
565 Lakeview Pkwy | Fax: (847) 573-1658 | www.objectmentor.com
Suite 135 | | www.XProgramming.com
Vernon Hills, IL, | Training and Mentoring | www.junit.org
60061 | OO, XP, Java, C++, Python |