A former professor of mine posed a question... “Why not program test-first?†. Out of pure experience, I hadto respond to his comment...
From: Jake Good
Sent: Friday, September 24, 2004 1:19 PM
To: Eugene Wallingford
Subject: TDDAnother case for which I think that TDD is often a better approach (when writing testsfirst) is the sheer complexity related to the capacity of the human brain. For instance,here we had a gigantic object model with lots of complexity with different business rulesand conditions at each spot in the model, yet the model was usable from its most toplevel point. Without writing tests at the top level first, we would have never been ableto conceive the types of mistakes or complexities related to other parts of the model.It’s almost a mix of integration testing and component testing… which can beuseful from the start.
I think when you test first; it’s not about how good you are, it’s abouthow granular you want you’re your code to be perfectly tested. Example, a blogframework, you might not want to test (programmatic test cases) the actual insert of datain your data layer, because you’ve done it a million times, but you definitely wantto write tests that fail for the abstraction of using your object model to actuallyinsert a post.
The short: I’m a fan of test first implement later
///////////////////////////////////////////////////////////////////////////////////////
Jake Good
Solutions Developer - code poet
Direct: XXX-XXX-XXXX
www.inetium.com
Inetium -- Business-Intimate Technology Solutions
//////////////////////////////////////////////////////////////////////////////////////
Then he posted another thought on how that affects education and developmentwithin the academic world, making relevance to the fact that when you do test-drivendevelopment, the intial time of development is increased (15%)... in which is not ofinterest to the common student who may be in other classes and/or have jobs. Anotheraspect is that traditional development learning and education does not TEACH theexperience or habit of test-driven development, so it's difficult for students to go from-- “Lets work on exactly what the teacher wants to happen†or the everpopular “Let's hack together a solution that generates exactly the outputnecessary, but hope that it works for 99% of the tests†... to “Let's testfor expected output first, then make sure our program passes the tests.â€
I know from my educational experience (which I used to be a student ofhis)... that the “hack†solution is good enough to get you buy at a 3.0scale. To excel, the effort has to be made to do some sort of testing on your output,whether its through TDD or other means.
Should the assignments be handed out and in cycle for longer periods oftime? No... I think in computer science education... the granularity in which you teachdevelopment has to be smaller than in other studies outside of science. The applicationof computer science relies heavily on the smaller aspects. So homework in smallersections is GOOD in that it ensures the learning of sections at a time. Applications toprove how a student learns as a whole should be taken into consideration as well. Glueingthe pieces together provides two fold knowledge: a) that the student learned the smallerpieces and b) that the student then can apply them in a meaningful fashion.
An approach taken by another one of my previous professors, Dr. Gray , was exactly what I just described. Westarted out in our Operating Systems class working towards learning the corefunctionality of an OS. Starting with memory and how to programatically alter it. Movingonto file systems and then user interaction. Each step of the way we demonstrated ourlevel of knowledge for the step, yet in the next section, were asked to build upon whatwe had and apply what we had learned so far to integrate into an entire system,eventually creating a shell application for Linux.
Another possibly scenerio is to use cooperative learning in a medium sizedapplication project , in which your granularity is not as small as each step, but youstill don't assign one long project. This allows the learning of each step, yet stillseeing the overall picture. My Western Civilization professor taught completely inthis method, it allowed us to learn more about what we were specifically researching, butnot as a whole.
http://depts.washington.edu/cidrweb/CooperativeLearning.pdf
To make a short story long: small steps but keep it relative and apply thesteps to see a whole.
< / rant >