Jake Scruggs

writes ruby/wears crazy shirts

When I first got into Ruby awhile back I found that I wanted to do something like I used to in Java:

public static final String BLUE = “blue”;

But darned if I could get the internet to tell me how, so here I am giving back to the community:

in solar_constants.rb:

module SolarConstants
MASS_OF_EARTH = 5.98e24

in some other file:

require 'solar_constants'
puts SolarConstants::MASS_OF_EARTH

or you can:

require 'solar_constants'
class Gravity
include SolarConstants

def print_mass_of_earth

This being Ruby you can, of course, redefine a constant. But you will get a stern warning.

One of the things that kept me from installing Linux on my laptop was concern about support for peripherals such as printers, digital cameras, USB devices in general, and my ThoughtWorks-provided EVDO card. The cool thing with Fiesty Fawn is that all except the EVDO card worked out of the box (I should say I had some trouble with my wireless on Edgy Eft). And the EVDO card only took about 5 minutes to get working after Peter Ryan pointed me to this article:

Get broadband wireless with Verizon EVDO and Linux

It's a few command line scripts to run and currently I haven't figured out how to turn it off or configure image detail (like you can with Verizon's software), but it works.

A light day for me as a 4 hour flight + 2 hour time change + wanting to see my wife for a few hours this weekend means I left early.

Before I get started I wanted to say a few words about Portland:

It's a great city. The train took us from the airport straight to the convention center (and our hotel which was 2 blocks away). Then we found out the train is free in the downtown area. So we had super easy access to bars/food/good times. Also the city, while being big enough to support an ecosystem of coolness is small enough to avoid being overwhelming.

Keynote – The Rails Way with Jamis Buck and Michael Koziarski:

General format of this talk was here's a submission we got for inclusion into Rails core and here is what's wrong with it. Oddly enough they called the people out by name – the ones who had the bad code. Not sure how I'd feel about being outed like that. [Correction: Koz informs me that people had submitted their code to The Rails Way (not core) and were asking to have their code 'publicly refactored' -- I totally missed that] Mostly I thought their advice about how to DRY up you code, but not at the expense of readability, was pretty good. I was distracted by the fact that the guy sitting in front of me had obviously slept on a chocolate bar. Did he not know that pieces of chocolate were sticking to his back? Or not care? Perhaps I should have told him.

JRuby on Rails with Charles Nutter and Thomas Enebo:

Well this was the topic of the moment and the presentation was pretty packed even though it was the last day of the conference and they had given a longer version of this talk as a tutorial. Their answer for why would you want to run Ruby on the JVM?

  • Full access to Java's Unicode support – which is way better than Ruby's
  • System threads instead of Ruby's green threads
  • All of Java's libraries are available
  • A Rails War file can be dropped into any app server – so its way more deploy friendly for Java shops
  • It's faster than Ruby's implementation

Not a bad set of reasons. What's the downside? Well not all gems work – if they have C in 'em they need to be ported. So no RMagick for you.

They ended the session by creating an app from scratch, turning it into a War file, and deploying it using Glassfish (an open source app server from Sun) using a JDBC driver.


All in all Rails Conf was good stuff. I want to thank the presenters and organizers for all their hard work.

Oh hey, if you run into Josh Cronemeyer get him to tell you about his late night experiences with the cross-dressing, freakazoid, marching band at a bar called Dante's late Saturday night. Its a good story. Better yet, get him to blog about it. I think he has pictures.

Keynote (AKA paid sponsor time) – Cyndi Mitchell (ThoughtWorks) and Tim Bray (Sun):

Cyndi seemed a bit nervous and well she should be – this is ThoughtWorks big play to mold the face of the Ruby/Rails world by announcing RubyWorks. RubyWorks is a “free, open source LAMP production stack is for RedHat Enterprise Edition and CentOS, and will allow users to quickly put Rails applications on production servers.” Pull it down, drop in yer Rails app, and you gots a server. It's all free, but if maybe you'd like some support we could perhaps sell you some. And we'll support JRuby. Pretty big move for us as a company. So why would we expose ourselves to this risk? Other than the tons of money we stand to make, ThoughtWorks feels like the Java/.NET world is all wrapped up with horrible bloatware and bad management practices and while we're still interested in fighting for change in those areas we feel think there's an opportunity to make a real impact in a wide open area. And it won't be open for long. There's a a lot of huge companies interested in Rails but worried it's not enterprise ready. How long will it take before there's a Websphere for Rails? And a Wasad/Rad for Rails? How long before programming in Ruby becomes just like programming in Java because the company you work for signed some huge deal with “Big IT” and you have to use the approved R2EE stack?

Best to get out in front of that and make a non-evil way to reassure large companies that using Rails is “safe”. Exciting and funny presentation – but it's possible I'm biased.

Tim Bray got up and talked some more about JRuby and at one point he called Cyndi back up to talk about why ThoughtWorks is deploying Mingle in JRuby and she basically said it was a way to get big companies to feel better about deploying it. But was really cool was to see ThoughtWorks and Sun freakin' Microsystems sharing the same stage and talking as equals. My little company (little compared to Sun) has grown up a bit. But I think it's really cool that we're still willing to take risks and make big moves. Our support of Ruby a year ago looked risky, and I'm hoping we'll look back on ThoughtWorks support of JRuby and RubyWorks a year from now and feel the same way we do now about getting into the Ruby/Rails space.

Custom Rails Helpers – Glenn Vanderburg:

Good stuff. This is a prime example of one of those talks where I totally new a bunch of what he was saying already, but I picked up a few things (like using content_tag instead of just dumping out the string of an html tag).

Glenn name checked Erlang which made him the second presenter of the day to do so. Showing that 12 minute video at the last Rails conf sure did resonate with some people. I vote that at next year comparisons to Erlang be made mandatory for all sessions.

The Business of Rails – Panel:

This was pure Rails pron and I enjoyed the heck out of it. 5 dudes who stuck out on their own and started up a Rails consulting company sat around and told war stories that were completely entertaining. Joe O'Brien recounted how he signed a fixed bid project that included “basic email functionality” that ended up becoming a re-write of Gmail for 20K. Everyone told how they fell on love with ruby and the cockles of our hearts where warmed.

The Dark Art of Developing Plugins – James Adam:

Very funny and informative. James started out with super Gothic lettering on the screen and a total Satan voice as he inducted us into “THE DARK ARTS OF DEVELOPING RAILS PLUGINS” which was hilarious. The good news is there's not much to it. You put the things you want to do in an init.rb file and the files init.rb needs go in a lib folder and any rake tasks go into a tasks folder and the rest is just dealing with how Ruby extends/includes things. If you want to add instance methods to classes you use include, but you need to use extend for class methods. You can overwrite included on an object to make it include and extend what you want. At this moment I was going: “Oh, that's why every plugin I've opened up has separate InstanceMethods and ClassMethods modules inside another module, and hey yeah they all do have an included method... Neat” I had been wondering that for awhile.

Open Mic Demo Session:

This is hopefully going to become a staple at Rails Conf (they did it last year too) as it's all sorts of wild. 10 presenters get 10 minutes to show something they've worked on. It ranged from the incomprehensible where some dude was talking about a yaml configuration plugin thing and half the dudes around me were muttering “what does this thing do?.” To the wacky, awesome, and probably useless Statisfy.net where you can put a bit of javascript on yer webpage and see real time hits to your site on a Google map (“hey someone in Africa just looked at my site!”) To the useful and cool: ThoughtWorks very own Alex Verkhovsky showed CruiseControl.rb. In 3 minutes he unziped the file, aimed cruise at an svn repo, and started up the server. Bang zoom there was a continuous integration site up and running. Pretty cool. Another cool demo was health portal where you could cut and paste any article from the site into your own custom page. It was all drag and drop and you could place the items exactly where you wanted them on the screen with a very cool online wysiwyg editor. I wish I remember the name of the site. Rats. [It's revolutionhealth.com -- thanks commenters]

I know a lot of ThoughtWorkers who worked crazy long hours to make the ThoughtWorks hangout/demo/vendor area so very cool and it was totally worth it – thank you so much. The joint was truly buzzing with activity. I remember one pretty typical moment where the following things were all happening:

  • I was working with Josh Cronemeyer on our fixture thing.
  • A Mingle demo was in full swing.
  • A small crowd was watching our looping video about ThoughtWorks
  • People were pairing on the Guv'nor app (using CruiseControl.rb and Mingle of course)
  • Dudes where chatting about JRuby (including some of the core team) in the lounge (sipping fancy fancy carbonated grapefruit juice)
  • Martin Fowler was holding court with some gushing fans.

Well done.

Finished the first day of Rails Conf and here are my impressions:

DHH's keynote:
Lets celebrate what we have. Blah blah blah. Rails has come a long way. Yadda yadda yadda. Here's a sneak preview of what ActiveResource is going to be like in Rails 2.0. Ooooh, Aaaah.

Actually the ActiveResource stuff was pretty cool. With a little bit of setup you can have one controller method serve up xml and text and html and all sorts of stuff. All RESTful style of course. And the debugger will be back (broken when someone fixed a bug in Ruby 1.85) and it will be a real debugger.

When will 2.0 be out? He didn't say. Go use edge if you dare.

Bob Martin's Clean Code Presentation:
On the one hand, this is a lot of stuff I've heard before (I hung around Object Mentor at the start of my career), but Uncle Bob is such a good speaker he got me all fired up again about TDD, Red Green Refactor, and incremental steps. There was this point where a slide was clearly missing from the presentation that showed what code he would write next, and he totally recovered so fast as to make you think he planned it. Then some guy in the audience tried to call him out on it and Bob turned his mistake into a virtue and expounded on the idea. Mad presentation skills: he's got 'em.

He used RSpec in his tests and that was awesome (the guy next to me actually cheered when he saw the tests were in RSpec). I'd like to take a moment here and yell at the Rails Conf organizers for having no RSpec talks, 'cause RSpec is easily one of the cooler things happening in Ruby/Rails. Why the freeze out? The jerk store called and its running out of Rails Conf organizers.

Oh and I liked that there was a lot of code in Bob Martin's talk. No pretty pictures and hand waving here.

Scale Rails Without Bounds on Amazon EC2:

Speaking of pretty pictures and hand waving...

I mean the idea of renting server time for 10 cents an hour is pretty cool. And being able to automagically kick off a bunch of servers when you need 'em (in 2-8 minutes) is freakin' bad ass. But where's the rubber meets the road details? Can we see some code? Nope. Boxes with arrows pointing to cylinders is all you get.

Btw, you better back up your data all the time 'cause when those servers go down you are totally out 'o luck (perhaps you might like to use Amazon's S3 (super soldier storage) for that?).

Standing on the shoulders Giants
Was too damn crowded so I couldn't get in. So Josh Cronemeyer and I paired on out plan to migrate fixtures -- coming soon.

Spam I Have Known by Jim Weirich:

Awesome -- Good speaker and a fascinating topic.

As Jim has been managing the Ruby Garden Wiki for the last few years, he has run into his fair share of spam (in this case, spam that has links to web other sites to give them the “Google Juice”). Some of the spam was stupid and hilarious (“I'm sorry for links my kids and my wife need food”). But some was super clever – Cross site scripting , zero height links, and pseudo encrypted text that used JavaScript to decrypt itself into more JavaScript.

Anyway, his solution was to create a “tar pit” for spammers. When they come in and are identified as spammers (through various combinations of content, IP address, lack of reverse DNS look up, being anonymous, etc.) they take the post and send it to a separate db and make it look like the spammer has succeeded. This means that if they come back to check to see if their spam is still there – they see a site with spam. Everyone else sees a site that is spam free. They do this because the spammers tended to learn from rejection. Rejected?, try again. And again. So every solution was overcome. By denning them feedback (and making it appear they have succeeded) Jim W. hopes to hold them off for longer. He incorporated this idea and many other spam prevention measures into a wiki called “Ruse.”

Later I fell in to conversation with Roy Singham, Martin Fowler, Ola Bini, DHH, and bunch of other luminary types. Then a limo pulled up and whisked them away. Guess I don't quite rate a limo yet. Sigh.

Buffalo burgers and beer at Voleur would have to suffice. Nice place, even if they did screw up our order. Twice. But that meant that we got to meet the chef who had a naked lady tattooed on his arm. Very cool.

Oh and I should mention that the ThoughtWorks hang out area is very cool. We're building a real live app using Mingle and the very Mac mini's I worked on at First Street Live. You too could get the chance to pair with a real live ThoughtWorker (gasp). Also there are Mingle (a very cool agile project management tool written by us) demos and lounge chairs and free soda pop and cute little give aways. Mad props to all who set this up.