Several times I've had to retrofit tests onto (or improve the test quality
and coverage for) an existing body of code.

It seems a good approach to this can be to put the existing implementation (
or at least any parts of it which are poorly spec'd) to one side, and do
"retrograde BDD", re-writing (which often, but not always, means pasting the
existing code in) as required to make the specs pass.

This takes time, but seems both less onerous than just writing tests against
an existing implementation, and also gives you ample opportunity to improve
the code itself as you go.

I was thinking about what makes BDD satisfying when you get "in the zone"
and start to look forward to the rhythm of red-green-refactor, and it
crossed my mind that there's something like operant conditioning at play:
each transition to green is a little reward. The nice part is that the
shaping that takes place is (hopefully) conditioning us to be better
developers.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
or Rails Oceania" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rails-oceania?hl=en.

Reply via email to