Slicing & dicing, and Chicago Code Camp!

May 31, 2009 at 1:55 pm (Ruby, Scheme, Watching, Week 10) (, , , , , , , )

Friday I spent the morning with Eric Meyer working on the same Rails app Jim and I had been working on last week. We got two bugs knocked out pretty quickly, and we also did some planning for a database refactoring (not as big of a deal as it sounds like, as the system isn’t in production yet). Eric’s laptop was having some boot problems, so we used mine; hopefully his Time Machine backup worked over the weekend – there aren’t many things more frustrating than not being able to boot. In the afternoon I chopped up a new website that should launch on Monday, showing Paul some tricks with the Slice tool in Photoshop along the way. I feel like I’m pretty efficient slicing up a PSD into XHTML/CSS – hopefully before too long I’ll feel that way in the code world!

Saturday was Chicago Code Camp, and it was awesome. The first session I went to was “Trends in Continuous Integration and Software Delivery” with Sean Blanton of OpenMake software. He went through the major features of a continuous integration system, and while we’ve got one in place for a couple of websites I work on (cc.rb), there was a lot of information there. I never realized how many different systems were out there. I was impressed with the fact that Sean wasn’t just pimping his products (Mojo and Meister) – it really seemed like a pretty fair assessment of the different systems. There were a couple of slides on Git, actually, which talked about how powerful it was, but that it might be hard for novices to get into. I thought that was odd at first, but as people asked questions I realized that Subversion and other systems have lots of GUI implementations that integrate tightly with OS’es, and Git doesn’t have so many yet. Maybe that’s a good project for someone…

Then I made the tough choice to miss Eric Smith and Eric Meyer’s talk on “TDD for the IPhone,” in order to attend Dean Wampler’s talk on “Better Ruby through Functional Programming.” Sorry, guys! I figured that since I’m working on a presentation involving functional programming, and I mostly use Ruby during work hours, I’d learn a lot there. And I did! I have a much better grasp of what functional programming is now, and how to apply that to Ruby (it can be done without too much hassle, actually). There was one particularly interesting point where Dean posited that we’d see programming (and concurrent programming in particular) become more functional on a small scale, but still object-oriented on a macro level.

Micah’s talk on Limelight (“Develop your Graphical User Interfaces (GUIs) faster than ever, with a thorough suite of unit tests to boot.”) was great, but it was tough because the 8th Lighters were the only Rubyists in the audience (I think), and there were only a few Agile/TDD practitioners. But there was a powerful point about what to do when something is hard to test: rewrite it so that it’s easy to test. And that’s just what Micah did with Limelight – which is indeed easy to test, once you know what you’re doing.

Next, I went to Dean’s other talk, “The Seductions of Scala,” and missed Jim’s “TDD and JavaScript” talk. Sorry, Jim! I had seen a version of Jim’s talk on Friday during the Lunch & Learn, and it was awesome. I’d of course heard about Scala because of the big Rails/Scala/Twitter debacle awhile back, so I was interested in what a language looks like that’s built with concurrency in mind. The language runs on the JVM, so like JRuby, it’s easy to interface with existing Java code. There is some strange-looking syntax to get used to, but it seems interesting, and it sounds like it’s gaining traction on production systems. I had thought the next language I took a look at would be Clojure, since it’s a Lisp dialect with concurrency in mind, and I’ve been studying Scheme, but now I’m thinking I may look into Scala. Or maybe learn JavaScript right. We’ll see. Incidentally, Dean’s new book, Programming Scala is available online in draft form as a preview – it looks great!

Micah’s last talk on “Ruby Kata and Sparring” was great. I’d seen forms of it before: the Langston’s Ant Kata and RubyConf 2008. There’s some kind of magical stuff in this version of the kata (instance_eval), but it’s extremely elegant once you understand the algorithm. I really like the notion of practice as important in software development; Paul was talking about this earlier in the day as well. I’m going to try to do the same kata 3 times a week for a few weeks and see if I see any benefits. I know from trumpet playing that even playing ridiculously easy exercises on a regular basis, with strict attention to form, can yield great benefits.


Permalink 2 Comments

Week 4, Friday

April 17, 2009 at 7:47 pm (Ruby, Week 4) (, , , )

Jake Scruggs and I started the day out by changing the feature I did yesterday so that emails would only be sent for 500 errors, not 404’s. This way people’s inboxes won’t be clogged with notifications when any old bot hits the wrong URL – or tries to hack it! It’s a good fix to begin with, but Jake also helped me to think through a refactoring that really cleaned things up. I was overriding the rescue_action_in_public method from the exception_notification plugin, and now that we needed it to act almost like the default, we had almost an exact copy of that method from the plugin. There’s an if-else statement that separates 404 errors from others, and the plugin, by default, calls its render_404 method and render_500 method, respectively. The obvious solution (well, obvious after the fact, anyway), was to instead override render_404 and render_500 to simply call our new method, render_error (which uses the Rails layout code to keep some consistency across the site). Much nicer, much cleaner. Thanks, Jake!

Eric and I finally got our continuous integration server up and running for the site, which was kind of an adventure. Note to self: use rake features, not cucumber features -n. CruiseControl.rb interprets the rake tasks better than command line output – or at least the setup is more intuitive that way. CruiseControl.rb, by the way, is pretty awesome: it’s a Rails app that monitors your Subversion repository and runs scripts of your choice, emailing build failures as desired. I can imagine a similar setup using Ant tasks for Java, and it looks like there’s a Cruise Control for that, too.

Eric and I started a small bug list as well, and knocked out several of those before we finished for the day (several styling things, and one or two things we didn’t consider when building stories). I’m definitely feeling much more comfortable in RSpec now: I wrote some helper tests after everyone else left for the day, and I knew exactly what I needed to do, in a strict TDD/BDD manner. I went pretty slowly, and because of my tests, and our already extensive unit and integration test suite, I’m pretty confident of the correctness of my implementation code (of course, I also checked manually to make sure I didn’t do anything stupid that I forgot to test). It’s nice not to feel overwhelmed by RSpec anymore. I still want to get the new RSpec book, but I’m feeling less and less that I absolutely MUST read it as I learn more on the job.

Permalink Leave a Comment