[rspec-users] Is BDD with RSpec cheaper?
mailing_lists at railsnewbie.com
Mon Jul 7 22:29:46 EDT 2008
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
> like: "It depends on the project". "Some jobs are so short that the
> time invested in developing tests doesn't justify the cost".
> He was insistent that writing tests costs more. After all, you write
> first the tests, then the code (or the other way 'round).
> My question is: From hard, practical, cold real world experience, is
> 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
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
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
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."
More information about the rspec-users