PDA

View Full Version : TDD and code performance/efficiency


Uncle Bob (Robert C. Martin)
07-17-2003, 11:51 AM
Steve Jorgensen <nospam@nospam.nospam> might (or might not) have
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 |


MyLounge.com Site Map
Forum: Cars, Cell Phone, Database, Games, Home Improvement, IT, Music, School, Sports, Web Design, Web Server, Weight Loss

The MyLounge.com forum is intended for informational use only and should not be relied upon and is not a substitute for any advice. The information contained on MyLounge.com are opinions and suggestions of members and is not a representation of the opinions of MyLounge.com. MyLounge.com does not warrant or vouch for the accuracy, completeness or usefulness of any postings or the qualifications of any person responding. Please consult a expert or seek the services of an attorney in your area for more accuracy on your specific situation. Please note that our forums also serve as mirrors to Usenet newsgroups. Many posts you see on our forums are made by newsgroup users who may not be members of MyLounge.com Term of Service