[LRUG] TDD

Rob Lacey contact at robl.me
Thu Feb 19 03:42:35 PST 2009


Romek,

I find it strange that you find the concept of testing absurd. Coming from a PHP background before Ruby, where at the time the testing was simply ...change code...refresh browser...repeat. It was quite refreshing to start using Test::Unit. And while I don't always find testing as pleasant and easy as it can be, I do find it a helpful and re-assuring way of iteratively producing code and allowing me to go back and change and re-factor safe in the knowledge that my code still fulfils it initial requirements.

When you say TDD is restricting code to what the tests require, that's true. But really what you're saying is my code is limited by what I expect from it, which is always true, your test suite is merely describing what exactly you expect it to do. But this doesn't mean your code is restricted. I see writing code about only writing as much code as you need to get the application out the door, quickly and reliably. I am sure you'll agree its more efficient to code to a set of goals and expectations, since without the expectations how do you know you acheived your goal.

I don't think there's anything wrong with the way you code, and you should always work with what you are happy and comfortable with. But if the problem to solve it designing an egg for a chicken. And you end up writing code that deals with chickens, badgers and then goes onto argue that all experience is relative to the person standing next the a lump of cheese on Sunday last, then realistically while you've gone on a magical journey the task itself may not have been solved in the short-est period of time and in the clear and concise way it could have been. Since I code for a living and I am ultimately responsible to my employer if anything goes wrong, it is far safer to test and have a way of assessing whether any changes I make as I go along don't break other areas of our application. In terms of focusing on the task at hand I am sure my employer is happier that through test driven development I am only developing only what is required for particular goals, leaving behind a suite of tests and requirements of the application that other developers can pick up when I have moved onto new projects and leaving the splicing of animals into new exotic breed to another day.

RobL


Tom Stuart wrote:
> On 19 Feb 2009, at 10:51, Francisco Trindade (Frank) wrote:
>> Tests are code, and are so difficult to write or maintain as 
>> development code.
>
> This is a seductive and commonly repeated idea but is demonstrably 
> untrue for things like Rails applications, particularly in the sense 
> that frameworks like Rails are targeted squarely at the "application 
> writer" and not the "test writer" -- one could make a fairly 
> persuasive argument that Rails is an incomplete framework until 
> writing and maintaining tests for a Rails app really is the same 
> difficulty as writing and maintaing the Rails app itself. We're not 
> there yet.
>
> I know we're not talking about Rails (or any other framework) here, 
> but it's definitely true that writing tests that interact with other 
> people's code is harder than writing your own code, and no sizable 
> Ruby application is an island.
>
> Cheers,
> -Tom
> _______________________________________________
> Chat mailing list
> Chat at lists.lrug.org
> http://lists.lrug.org/listinfo.cgi/chat-lrug.org





More information about the Chat mailing list