[rspec-users] bad specs better than none?
glenn at aldenta.com
Thu Feb 28 08:22:38 EST 2008
I have a similar perspective from my own personal experience. I am
still quite the novice, but I'm as much of a novice in RSpec as I am
in Ruby / RoR. Honestly, a lot of my specs in new sections end up
having great coverage, but are full of real models and few of the
"purist" BDD practices. Before I started with BDD I did a lot of
reading so I feel that I have a good understanding of the goal, and I
do have some specs with little database access and great
implementation of the MVC "goodness" that RoR supports, but I simply
can't always keep this up even when I want to.
A lot of times if I'm writing some code for a challenging piece, it's
challenging to me because I don't already know how to do it. I can
write the basic "here's the setup, result.should eql(this_thing)" but
I can't write any mocks/stubs/should_receives in the middle because at
every step, I just honestly have no idea how it should work!! So I
throw in real models and try to make it as real as possible, rather
than as "pure" as possible. It's not until after I get things working
that I even know what the solution should remotely look like. This is
due to my inexperience that I have to hack around a lot before I
figure out how to make things work. Unfortunately, I know this means
I write code that is more complicated than it should be, but if I
can't figure out a better way, I have to write something that still
So while I have a lot of the knowledge behind the theory of good BDD
practice, I can't always implement it even when I want to. My Ruby /
RoR inexperience is what holds me back the most in that department.
It's just something I have to cultivate really. Until then I'm happy
with my green specs with excellent coverage that slam the database
like crazy and take a long time and have few mocks/stubs/
On Feb 27, 2008, at 10:45 PM, Kero wrote:
>>> I also had to go into specs on a project I'm not working on, and
>>> an unholy hive of database-accessing specs. It's disheartening.
>>> Basically, it's cargo cult development practices - using the "best
>>> practice" without actually understanding it.
>> This is a really tough problem. The whole motivation for BDD was
>> "people don't get TDD, so let's come up with some new ways to frame
>> so people get it." Now people don't get the new frame. In that
>> we've made things twice as bad.
> What did you expect? Honestly?
> You need to show people the Right way, otherwise they're unlikely to
> it out by themselves. But as the fortune cookies go:
> "To make the right decision, one needs experience.
> To gain experience, one needs to make the wrong decision."
> It is easier for me to explain this from the point of view of aikido:
> I've been shown the right moves thousands of times. I can not even see
> what sensei does, let alone reproduce it. I can not perceive the
> the timing, the acceptance of an attacker and the reflection of his/
> energy to -ultimately- unbalance. How could I learn by trying even
> or hundreds of thousands of time?
> After seven years, I'm still a puny beginner. And I need other people
> to show me my mistakes. Again, again and again.
> To the original poster: yes, teach BDD.
> Make sure they accept you as a teacher,
> then teach, small steps at a time, by showing what is wrong.
> when they figure out a solution by themselves, encourage them, accept
> that solution (use it yourself). When they don't figure it out by
> themselves (likely enough), show how you would do it.
> And be prepared to repeat yourself.
> rspec-users mailing list
> rspec-users at rubyforge.org
More information about the rspec-users