I read this whole thread with interest (alerted by a cross-post on the railsbridge list, thx Zach). Thanks Stephen for kicking off this interesting discussion:

> Given time, I think the patterns facilitated by RSpec could
> *completely* revolutionize the way software happens everywhere, *if*
> the next generation of developers come to learn it first and not as an
> "add-on."  ...
>
> Does anyone else think that'd be pretty cool?
>
Yeah, I think having such resources available would be very cool.  The
most common complaint I hear in IRC rooms is that there is no good
sample rails app that makes good use of RSpec and Cucumber.  I think
there are some examples out there, but an app built as a tutorial would
be much more helpful with the proper git tags and such.  I mentioned
before that I was helping prepare a rails course. This is with my local
Ruby group and we have started on a tutorial app:
http://github.com/urug/media_lender/tree/master
It thought it would be cool to use this project and BDD all the way
through and teach it like that.  However, I have other commitments so
other people in the group will probably do most of the work without
BDD... It is something I would like to revisit someday and provide such
an app.  Have you started on a tutorial app like this yet?


I am very interested in understanding how to teach TDD/BDD. I learned both as part of learning Rails. As an experienced programmer in other languages it was really important to me to learn testing as I learned this new language, since my motivation for learning was that I was taking a job as a solo engineer on a legacy Rails 2.0.2 codebase. I felt if I didn't really understand testing, I was going to be in a world of hurt. I also was just really excited about cucumber when I first heard about it.

I decided to start learning BDD on day 3 of learning Rails and documented my experience as a tutorial here: http://www.ultrasaurus.com/sarahblog/2008/12/rails-2-day-3-behavior-driven-development/
http://www.ultrasaurus.com/sarahblog/2008/12/rails-2-day-4-rcov-and-more-behavior-driven-development/

Later I learned about RSpec and the out-of-the-box testing that comes with Rails. I ended up hiring someone to work with me on the Rails project since it ended up being a pretty big job and we used TDD as a way to understand and document the codebase. Learning by doing with pair programming was an awesome way to learn. We use Rspec mostly for model testing and cucumber for integration (controller/view) testing. We have a few specs for controller and views, but using cucumber at the higher level seems to work very well.

Recently I taught a one-day workshop where I taught people who already knew a different programming language how to program in Ruby on Rails. I added in TDD in the afternoon and I think it worked really well. (Note that we only got as far as model testing) I think it worked well to scaffold first to introduce people to what a Rails app "feels" like, then use testing as they add their own code.

I'll be teaching the same class in August and look forward to fleshing out the curriculum a bit more and seeing if I can get some feedback afterwards on how it was for the students. The workshop is "open source" and you can look at what we taught here: http://wiki.devchix.com/index.php?title=Workshop_Topics (see #Add_votes for where the TDD part starts. This is a work in progress, and some of the notes are rough) In this workshop, I made up the TDD part of the lesson on-the-fly with my pair-teacher since I felt so strongly that it needed to be taught. Another teacher who taught the class as it was originally written said that the adding votes & associations section was hard to teach since you needed to write so much code before you saw any results. The immediate feedback of TDD makes it fun to teach.

As someone who recently learned Rails and Ruby, I feel strongly that TDD/BDD should be learned right along with the rest of the framework. While I do love RSpec, I'm not sure it should be taught first thing, primarily since I think people should understand the parts that come with, but it also feels like there is a lot of detailed APIs you need to know. I do find it interesting that cucumber, which is a higher level framework, doesn't feel that way.

Sarah
http://www.ultrasaurus.com



_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to