Noel Rappin Writes Here

WindyCityRails

September 13, 2010: WindyCityRails

WindyCityRailsNoel RappinComment
I'm going to have an official WindyCityRails conference report up on the Obtiva blog shortly. Consider this the more self-indulgent conference round-up.

Ray Hightower and the rest of the team put on a great show, everything ran smoothly, and even the typical complaints about WiFi were kind of muted.

When I'm at a conference, I tend to use Twitter as my notebook. People seem to appreciate it, it's nice to get quotable lines out into the community, and it gives me an excuse to monitor the Twitter backchannel. So, check out @noelrap for some play-by-play.

The iPod + bluetooth keyboard worked great for this -- if I wasn't presenting, I wouldn't have used the MacBook at all. Not least of the advantages was that I didn't have to fight for a power strip. The only real disadvantage was that the fairly wide view angle meant that anybody sitting next to me had a great view of my twitter-stream.

It was kind of funny to be able to recognize my Twitter-avatar popping up on laptop screens in front of me, suggesting that I was twittering too much (though I do seem to have gained followers over the day).

Also, the much-maligned Twitter/iPad interface was a champ -- particularly great was the ability to continue to work through all the browsing screens with a compose window open.

Anyway, the conference itself was fun. It was amazing to me how many people I know there now, considering that two years ago at the first WCR, I knew about three people that I didn't actually work with.

One highlight was talking with David Chelimsky commiserating about book processes when somebody came up to mutually ask us a question about testing. Thankfully, we agreed.

My own session went reasonably well, you can check out the bad code I wrote about over on github. I made kind of a rookie mistake in that I wasn't completely prepared to explain basic Cucumber and RSpec usage along with the legacy testing strategies. This became mostly a time management issue, and while I managed to get through everything I wanted to say, the session became a lot less hands-on then I was expecting. I mostly got positive feedback, though, so I think it was okay.

I do think I sold more of the RSpec book then of my own, indicating that I don't really understand this self-marketing thing.

I got a lot of ideas for performance follow-ups from John McCaffrey's talk and later from Nick's Gauthier's slides on test suite performance that I expect to include in future apps.

September 10, 2010: Just a thing or two

WindyCityRailsNoel RappinComment
I've got a bunch of half-written posts, none of which you'll see today since I've been spending all my time getting ready for WindyCityRails tomorrow. So, some quick hits and things to mention before I forget...

Beta 7 of Rails Test Prescriptions came out earlier this week. The big addition is the chapter on RSpec. I'm happy with how this one came out. And now I can see the light at the end of the tunnel, with only one or two chapters left to write.

Speaking of WindyCityRails, registration ends at 2PM today (Friday the 10th), and they say no tickets will be sold at the door. There are still tickets available as I write this for both the conference itself and for my tutorial. It's going to be great, so be there.

Continuing the self-promotion, the interview I did for the coderpath podcast is now online. Other than the fact that I sound like I'm connecting via dialup, I'm happy with how it turned out. At the end, they ask when the book is coming out, and I say that main writing will probably be complete in August or September. Turns out that's a bit optimistic, but I'm hoping only a bit.

And on other blogs... I'll also be contributing to this RubyLearning Blog post series. Should be fun.

Obligatory Apple thing As you probably heard, Apple released explicit, written App Store guidelines yesterday, along with clarifying the review process. The best part is that the guidelines are actually written in plain English with a relative lack of legalese. Granting that they should have done this when the store came out, this is still a great step and should reduce the uncertainty around the store somewhat. They also loosened the rules around non-XCode projects, which is good, and maybe leads the way to getting projects like MIT's Sketch in the store, I hope/

August 26, 2010: Some New Stuff

JavaScript, Ruby, WindyCityRails, Yehuda, rvmNoel RappinComment

Book Status



RSpec chapter draft handed in to edit. It's going to need a better conclusion. A lot changed in this one, relative to the Lulu version -- this is probably the chapter most affected by my own personal experience since it's original version.

Links



Haven't done a link set in a while, this is going to be kind of random.

Still seats available for both WindyCityRails in general, and for my tutorial in specific. But the sponsor list has filled up.

Motorola bought 280 North, best known for their Cappuccino JavaScript framework, and the 280 Slides application. Apparently, Motorola plans to use them to make web apps aimed at Android devices. Should be an interesting culture clash.

I've been looking through the Rails 3 unobtrusive JavaScript stuff trying to figure out new practices. The Trevor Turk blog has a code snippet for setting up a form that submits when a checkbox is clicked. Like it. Love to see more examples like this, it really shows how clean the Rails 3 structures will be.

Ever wish the Ruby Date and DateTime classes were faster? Course you have. Here's home_run, a C implementation of the Date and DateTime classes that claims a 20 - 200 time speedup. The Readme page shows how to use the home_run classes instead of the standard ones, if you are feeling adventurous.

I love stories of tracking down obscure bugs, and Yehuda Katz has a great one about bundler, rvm, and various shell interactions. Debugging is maybe the important skill, so watch an expert's process at work.

Speaking of rvm and it's awesomeness, here's a quick guide to putting rvm, bundler, and passenger together on a Rails deploy.

Here's a little test snippet to solve the problem of how to test an abstract controller by adding a small controller in the test page and creating a route for it.

August 11, 2010: An Abundance of Options

Ruby, WindyCityRailsNoel Rappin4 Comments

Book Status



Shoulda chapter fixes made. The next decision is whether to push that as a beta by itself, or wait until the RSpec chapter is also done.

Also



Today is the last day to get early bird pricing for WindyCityRails.

Book Status



I did not know that Ruby 1.9 had its own coverage tool. Aaron Patterson shows how to use that tool and a little code to create useful output for coverage testing.

I'm really happy to see some discussion of what good style is for Cucumber tests. Jonas Nicklas argues in favor of what I call in the book the implicit style of testing. He closes with "A step description should never contain regexen, CSS or XPath selectors, any kind of code or data structure". I think that's got it right. I was just deciding not to add a Cucumber/Factory add-on to my project and decided not too for reasons articulated pretty well by Jonas. The goal of Cucumber is not to write as few step-definitions as possible.

Dane Harrigan discusses handling Rails exceptions from Ajax calls. It involves what may be the first actual use case of an around_filter I've ever seen.

Xavier Shay argues that database constraints make it easier for new developers to understand your code. Hmm... I tend to be not a fan of database constraints. Or more accurately, I tend to be very cognizant of the development costs of adding database constraints, so I only add them when they seem necessary. It's hard to argue, though with the idea that the code and database should not actually conflict.

The Silence is Foo blog gives an almost obsessive amount of love to the splat operator. Yay! The splat operator is one of my favorite corners of Ruby (as it was one of my favorite corners of Python). Even so, I learned a couple of new splat tricks from this article.

I'll close here with a little debate on choices in Ruby and Rails. Kevin Gisi has a satirical little number on how hard it is to be a new Ruby developer and choose among the various options for everything. Peter Cooper at Rails inside offers not a rebuttal exactly, but a slightly different take on the issue. Kevin is obviously writing tongue-in-cheek, so you can't exactly get worked up about him going overboard, and I agree with Peter's take that things could be improved with better presentation. I do think that both Ruby and Rails have gotten a bit less novice friendly (as many projects do over time as complexity gets added). I don't think it's an unsolvable problem, but we can always make it easier for new people to come on board.



Aug 9, 2010: I Shouda Seen This Coming

RSpec, Shoulda, WindyCityRailsNoel RappinComment

Book Status



The Shoulda chapter is draft complete, after a slight restructuring to change the emphasis of the chapter, and a lot of syntax changes. My previous version of the chapter was written before Shoulda went in the direction of RSpec compatibility and so there were a lot of syntax changes that needed to be made, particularly to the way you create Shoulda extensions, which used to be much simpler.

Promotion



WindyCityRails has extended the early bird pricing through August 11, because of the addition of Ryan Singer from 37signals to the schedule. Those of you who are obsessively following the schedule with an eye on how it affects me -- which, I suppose, is pretty much just me -- now see that my tutorial session no longer overlaps with Yehuda Katz, but does overlap with Ryan Singer.

My tutorial is called "Testing in a Legacy Environment", and will talk about adding TDD/BDD to an existing code base, with a focus on practical ideas and working with an actual fake legacy code base. I think it'll be a lot of fun, and I understand that tickets are still available. So register.

Editiorializing



One of the issues that made the Shoulda chapter require some rework is that the Shoulda team has changed how they think of Shoulda. I'm paraphrasing here, but I think it's gone from "RSpec alternative for use with Test::Unit" to "Tool for single-assertion shoulda-style testing in either library. But especially in RSpec."

On the one hand, I really like having Shoulda syntax available in RSpec. It makes RSpec a lot more interesting to me, and I like the way single-assertion style looks in RSpec. That said, and also knowing that the Should team owes me nothing and absolutely needs to write the tool they want, I do think I'll miss having Shoulda as a full alternative to RSpec.

Let me back up. When I first started using Rails, I used Test::Unit because it was most similar to the tools I had been using (JUint, PyUnit, SUnit). As I got integrated into the Rails community, I became aware of RSpec, and thought it looked cool.

My first experience or two with RSpec went badly. RSpec, at that time, was very heavily into a mockist style of testing (or at least that's how it seemed to me), and for whatever reason I really struggled with making mockist testing work for me in any kind of reasonable flow.

If I remember correctly, Shoulda came out while I was in the middle of my first major Rails project as a consultant. I liked the single-assertion style immediately, and also liked the ability to get some RSpec flexibility without having to make the commitment to RSpec. Shoulda was much easier to add to an existing project.

Shoulda got popular quickly, I remember a talk at RailsConf '08 comparing all the testing tools and concluding that Shoulda's big advantage over RSpec was that it was much easier to extend. Shortly after that, as I got into a position where people would ask me questions about testing, "which framework should I use" was a popular first question.

When I started writing the Lulu book, it made perfect sense to have the book not focus on RSpec, since the non-RSpec tools at the time had very close parity to the RSpec feature set. I believed (still do) that it makes sense for a new user to start with the baseline Test::Unit features because they are simpler and because most Rails programmers know them. The fact that there was also already an RSpec book in development, I admit, was also a consideration.

A couple of interrelated things happened over time:

The Test::Unit ecosystem, including Shoulda, Jeremy McAnally's context, and other add-ons like Zebra basically stopped being worked on.

Cucumber became very popular, and integrates with RSpec better than Test::Unit, making the RSpec ecosystem stronger.

I had my first really good experience with RSpec, and I'm now much more comfortable with it than I was. There are a lot of RSpec features I didn't know about before that I love now.

As a result, or at least at the same time, I don't get asked the question about which framework to use any more.

In some ways this is too bad, some people genuinely don't like RSpec syntax, and I think that if somebody was to fork the pre-RSpec version of Shoulda and maintain it, that would still be a viable tool for some members of the community. At the same time, it's not like I'm jumping up and down to be that maintainer, so take that with a grain of salt.

Anyway, this leaves me in a weird place, with a Rails test book that covers RSpec, but isn't really about RSpec. I think that a lot of the advice and tool coverage in the book is applicable to RSpec or Test::Unit users, but I worry that Rails users who are already in the RSpec camp will assume that my book has nothing for them. (Note: I think it does. But then I would, wouldn't I?) But this isn't the only decision I made in the book that looks different a year or so later. (For example, I picked Machinist over factory_girl as factory tool to emphasize. I might have to redo that one also...)

I'm not sure what my point is by now. I like RSpec, and I like Shoulda, and I even like them together. But I also liked them apart. And what makes writing in this community both so much fun and so agonizing is that everything changes all the time.

August 4, 2010: A couple of useful things

Apple, Safari, WindyCityRails, rvmNoel RappinComment

Book Satus



Still patching the Shoulda chapter together. Realized yesterday that Machinist is in the middle of a version 2 upgrade, which, along with some factory_girl changes probably means I have some tweaking to do in that chapter.

I haven't run the buy links in a while. You can get the beta ebook and pre-order from Pragmatic and the book is also available from Amazon.

WindyCityRails



Early Bird pricing for WindyCityRails is scheduled to end today. I'm doing the PM tutorial on "Testing In A Legacy Environment". Please sign up, I'd hate to talk to myself. Also watch WindyCityRails for another speaker announcement that should be coming up very soon. There's already a great lineup, and they run a super-great conference.

Links



This is handy given what I've been doing this week. Christoph Olszowka has made a bash completion script for RVM commands. I wonder if it will work in my zsh shell.

Speaking of useful tips, on the off chance that anybody stumbles across this who doesn't read John Gruber, he has a useful OS X service for opening all the URL's in a selected text as separate Safari tabs.

Former Apple engineer Sachin Agarwal, now at Posterous, lists some things he learned about project management from his time at Apple.