Cassius Rosenthal on 13 Sep 2007 19:22:33 -0000 |
Toby DiPasquale wrote: On Thu, Sep 13, 2007 at 12:26:16PM -0400, Cassius Rosenthal wrote: I have written 5 apps using the BDD/RSpec approach from get-go, including the one that I wrote for the presentation. 3 of the 5 have what would be considered incomplete spec coverage, because we knew what we were doing and did not keep the specs for restful routes, nor did we test the Rails validation helpers. Just as it is frowned upon to rspec whether ActiveRecord can save a record, I think it's equally pointless to rspec whether validates_length_of can return an error. I have also written a rather sophisticated online business simulation used by two of the top-ten pharmaceutical companies, which began prior to RSpec and hence was written without BDD. So I have the experience to speak to small teams and small-to-medium code bases used from personal to enterprise applications. You can take this quote as an opinion backed by some real-world experience: "With a small number of programmers working on a quick app, experienced coders would do better to just write the implementation, and reserve specs for unusual models and logic." The largest application that I am currently working on has a distributed network of coders. In this case, RSpec is not an option because of the learning curve for a few of the other coders. So while I am allowing that in the best case, large teams working on a large code base would see the additional time added by RSpec approach marginal --because of the reduction in bugs to offset the additional code-- I have not had the opportunity to test this. So my experience suggests that RSpec is at least useful for unusual models and logic. I am hypothesizing that fuller specs have a greater benefit for larger projects. In both cases, I maintain that RSpec has many drawbacks including the ones that I listed previously, and people should be aware of them. Cliff Moon wrote: I agree that this is one of the best things that RSpec has going for it. Writing: "user.should have(4).dogs" feels very cool, and serves well for an API psuedo-documentation.As for BDD, my understanding is that the point of it is to make your tests into executable documentation. Steve Eichert wrote: It was mentioned that RSpec causes you to violate the DRY principal. Do you think that violation is appropriate?Yes; I think it is appropriate because that's the way RSpec was designed, and I'm appealing to everyone to accept it as a convention. I wish it didn't work out that way, and I think it's going to be one of the most difficult aspects of RSpec to deal with, but I do not have a better solution. I do think that helper modules will be abused. Getting the average Rails coder to switch gears between DRY implementation and RYO specing will be a hassle, but hopefully less of a hassle than cleaning up bugs. Thanks! -Casey _______________________________________________ To unsubscribe or change your settings, visit: http://lists.phillyonrails.org/mailman/listinfo/talk
|
|