East Bay Ruby Meetup Group organized an event on April 20th, 2010 at UC Berkeley with Sarah Allen who talked about learning test-driven development (in the context of Ruby/Rails) through test-first teaching.
The longer answer is that by writing unit and integration tests, along side of the code that it takes to pass them, slowly, line by line, you learn what you are doing and are able to engineer better application code than you ever will be able to by creating scaffolds and perhaps looking back at the code.
Ok, here is where I think Rails & TDD clash: What do you do when you decide "ok, I need a scaffolding with a controller and model etc" Do you generate a scaffold (and also a migration) with 1 field & then continually write more & more migrations for just one field or updating just one field? That doesn't make sense to me. I think there needs to be a little bit of balance here so if it were I would write all of the tests for 1 model and THEN product the scaffolding (or whatever) and go from there
@m3talsmith thanks for that. I'm actually working on a rails project this weekend so I will keep this in mind.
DJTripleThreat78 7 months ago
@DJTripleThreat78 Short answer - don't use scaffolds.
The longer answer is that by writing unit and integration tests, along side of the code that it takes to pass them, slowly, line by line, you learn what you are doing and are able to engineer better application code than you ever will be able to by creating scaffolds and perhaps looking back at the code.
m3talsmith 7 months ago
Thanks, good video to start TDD.
vadkant 1 year ago
Ok, here is where I think Rails & TDD clash: What do you do when you decide "ok, I need a scaffolding with a controller and model etc" Do you generate a scaffold (and also a migration) with 1 field & then continually write more & more migrations for just one field or updating just one field? That doesn't make sense to me. I think there needs to be a little bit of balance here so if it were I would write all of the tests for 1 model and THEN product the scaffolding (or whatever) and go from there
DJTripleThreat78 1 year ago 2