On Jul 7, 2008, at 2:25 PM, yitzhakbg wrote:
This might be a loaded question on this forum, but here goes:
Just had a discussion with a prospective employer, a Ruby On Rails
shop. His
reaction to BDD development on every project was skeptical, saying
something
like: "It depends on the project". "Some jobs are so short that the
extra
time invested in developing tests doesn't justify the cost".
He was insistent that writing tests costs more. After all, you write
twice:
first the tests, then the code (or the other way 'round).
My question is: From hard, practical, cold real world experience, is
that
so? Is BDD development more expensive? Let me qualify that. One could
answer, "no, since the tests save you pain and heartache down the
line". The
question is whether BDD coding with RSpec is more expensive in the
implementation phase and how much truth there is in the statement
that BDD
isn't for every project, like quick knock ups for example?
Yes - of course it will slow you down. There is nothing wrong with
leaving code unspec'ed (just be aware of the consequences).
Almost every app will grow to a size of immense complexity (i.e. every
app in it's fullest wants to read email). If someone is paying you
for it (and it's not a prototype), it almost always needs specs. The
real question is: how much is my software worth? How much should it
be worth?
If it's worth nothing, it needs no specs. If it has any plans to grow
(or is already big), or is ever going to be maintained by someone else
besides the original maintainer, it needs specs. (There is one obvious
exception to this rule: Prototyping needs no specs, and actually
hampers growth).
There have been many times when I've been in a "rush" to get a piece
of code done, and so I don't spec it. I almost always find a bug in
it later on, and always regret not spec'ing it. I'm not a testing
fanatic - I'm human (and make so many tiny mistakes it's almost
unbelievable).
Dave Astels said something a while back to the effect of "Unspec'ed
code sucks". I'm okay with short scripts and data migrations
sucking. I don't plan to spend a lot of time on it, and in the end,
I'm going to throw it away. No reason to keep a test suite around for
it. This is why you'll hear many people say, "if it is under X number
of lines it doesn't need specs."
Scott
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users