Great talk by Adam Wiggins here at RailsConf. But this post is more a reminder to me than a synopsis for you. Find out more at adam.blog.heroku.com and railscasts.com/episodes/150-rails-metal.
May 6, 2009
This morning’s keynote speaker at RailsConf mentioned, in passing, working on some code without named constants. When something needed to be changed you’d have to find the right instance of it and change it, and hope you changed it everywhere you needed to. It’s elementary that you should use named constants for just that reason. But this story reminded me of an early programming experience I had with FORTRAN IV on a CDC 6400.
You see, when you write a 1 in your code, you’re kind of using a named constant. That 1 is is the name of a value (that happens to be one, or 000000000000000000000000000000000000000000000000000000000001 in bits on the 6400). We always expect that the value of the constant named 1 has to be one. But in my freshman programming class, I managed to change the value of 1 in my source code to zero. FORTRAN programmers will probably know how I did that.
This made for a wonderfully oddly behaved program. The first time through a loop always worked, later ones always failed, and it didn’t matter what values I set before each run. The story had a happy ending: I learned how to read core dumps and a bit more about machine language, and moved on to other programming languages that make it harder to change the values of literal constants.
May 5, 2009
David Heinemeier Hansson is opening the conference, quite appropriately, and saying a lot of interesting things about the past and future of Rails. The conference is going to post video of the keynote in a day or so, and I recommend watching it. But what got me sitting up straight and listening more alertly was when he started talking about something else. Requirements.
David says that programmers treat requirements as commandments from on high. And that they shouldn’t do that. The stakeholders aren’t are committed to the requirements as programmers think. They know what they want, but they’d be just about as happy with a lot of other solutions, too. And those other solutions might be a whole lot less expensive to provide.
His example concerns chocolate. He’s got a sweet tooth. Ask him for requirements to satisfy that sweet tooth, and he’ll specify top quality Belgian chocolates. Meeting those requirements will take a lot of money and a lot of time. Maybe that’s necessary. But try offering a Twix bar right now for just a buck or so instead, and most of the time he’ll actually be happier with that.
The real key to programmer productivity is saying no to requirements as stated, and instead understanding what the stakeholders want to accomplish and opening negotiations with them on the best way to do that. Requirements are a starting point to that. They’re not handed down to us on stone tablets.
That means programmers have to be much more involved with stakeholders, and take more responsibility for the ultimate outcome of their efforts. But they’re going to create a lot more value if they do that.
May 4, 2009
I’m here at RailsConf looking for a bit of cold, free, sweet caffeine at the break. There are plenty of sodas, and they’re even the right brand – Coca-Cola.
But unless I want a lot of empty calories, my only choice is Diet Coke. Which is drinkable, but only barely. (Pepsi fans: don’t gloat. No other brand of diet cola reaches even that level.)
This is a travesty because now Coke Zero exists. Somehow they’ve managed to create a diet cola that really tastes like Coke (the only cola that has ever mattered)! But you can almost never get it at a meeting or restaurant because they’ve got the old standby Diet Coke. And Coca-Cola is fine with that because it helps in their goal to fill supermarket shelf space with several thousand different products all called Coke.
Coke Zero is a better choice than Diet Coke in every single circumstance. Coca-Cola, you’ve got a responsibility to us – fix your advertising and branding and GET RID OF DIET COKE! Let Coke Zero take off and fly!
And while you’re at it, get rid of Cherry Coke, Caffeine Free Coke with Lime and Splenda but without added Vitamins, and all those other stupid variations. There are only two drinks worthy of the name “Coke” – Coca-Cola and Coke Zero.
I’m starting this year’s RailsConf with a tutorial on jRuby on Rails. I’ve fiddled with it a few times, and I have the distinct impression that it’s a more stable production platform than the regular Ruby interpreter. But there are a few issues I’ve had. I hope today’s tutorial will help me resolve them.
I’m not much of a note taker, so this (and other posts this week) will probably be pretty thin, with just reminders of core information tidbits I glean here.
The speaker is Nick Sieger of Sun Microsystems, and he’s put his slide desk online at his blog. The link to the actual slides isn’t there (yet), so I won’t put it here, either. It looks like he’ll probably soon put up a post with the link.
The talk is going to start from absolute zero. Since I’ve actually installed and used jRuby (very casually) there will be some familiar stuff for me at first.
Download GlassFish, a Java application server we’ll be using.
Download jRuby, too (this is the latest production version as of today).
You’ll need the real JDK, too.
Install the JDK. Add its bin subdirectory to your path, and set an environment variable named JAVA_HOME to the root of the JDK install. Test it by running “java -version”.
Install jRuby by unpacking it anywhere you want. Add its bin subdirectory to your path (he emphasizes adding it to the end of the path). Test it by running “jruby -v”. Run irb or other Ruby tools by prefixing them with “jruby -S”, as in “jruby -S irb”.
Run jRuby with the Java “server” VM with “jruby –server”. That’s better overall performance, at the cost of slower startup. You can pass a variety of Java arguments to the JVM with “jruby -J<argument>”.
Oh, you want jRuby at the end of the path so that its utilities don’t run when you want the regular Ruby ones. So “rake” gives the regular Ruby rake, “jruby -S rake” gives the jRuby one.
jRuby has all the standard 1.8.6 Ruby things – the libraries, RubyGems, Rake, RSpec. It’s also integrated with the Java libraries. Go into jRuby’s irb, and type
java.lang.System.out.println “Verbose Hello”
It works! Not that you’d want to do that, but I’m sure I’m going to want to use the Java cryptographic tools.
Install a bunch of needed gems (I had to be in a command shell with administrative privilege to do this in Windows 7):
jruby -S gem install rails mongrel jruby-openssl
Now, just create a Rails application with “jruby -S rails appname”.
Install ActiveRecord-JDBC or MySql or SQLite3 (or both):
jruby -S gem install activerecord-jdbcmysql-adapter
jruby -S gem install activerecord-jdbcsqlite3-adapter
Now fix your Rails application’s database.yml to point to the JDBC version of the appropriate database adapter. For example, “adapter: jdbcsqlite3”.
Now here’s a trick I could have used (and will be using)! Use embedded Ruby to have a single configuration file work for both jRuby and MRI. Put this in database.yml:
<% jdbc = defined?(JRUBY_VERSION) ? ‘jdbc’ : ” %>
adapter: <%= jdbc %>mysql
[I just noticed that WordPress is “fixing” my single and double quote marks, even in code. It’s easier for me to tell you figure out that they’re really all straight quotes than to figure out how to get them in WordPress right now.]
And now create a Rails application in the regular ways. Just remember to use “jruby” instead of “ruby”, and to prefix other commands (like rake) with “jruby -S”.
Found a bug (in jRuby? in Rails? hard to say, but probably either in Rake, or in a Rails Rake task): if your Rails application’s environment.rb specifies needed gems, you can usually install them with:
But, if you use:
jruby -S rake gems:install
it says it works, but it doesn’t (“jruby -S gem list” doesn’t show them). It appears that it installs these gems under MRI instead of under jRuby. Of course, you can just manually install each needed gem with “jruby gem install”. It’s just the Rake task that gets derailed. Note that this happened under Rails 2.2.2, which is what our existing application under development is currently using. I haven’t checked to see if it still happens in Rails 2.2.3 (the current version as of today).
You can speed up Mongrel under jRuby by removing the mutex it no longer needs. You have to edit Mongrel’s source to do this. Look for the block starting “@guard.synchronize” and comment it out. You have to also set “config.threadsafe!” in your application’s appropriate environment file to have this help (or change it globally for Rails under jRuby by editing lib/initializer.rb there.
The speaker’s JRuby-Rack gem allows you to run any Rack-based application (like Rails) under any Java Servlet API server. That sounds promising for production use. I’ve got to learn a lot more about the Java server ecosystem to take advantage of it.
The talk is now really turning to ways an experienced Java shop can run Ruby on Rails well in their infrastructure. There’s a lot of background I don’t have, so this can point me to the right place to start, but I can’t understand it well enough to use it as a result of this talk.
Lots of talk on Warbler – I don’t have the context to understand it now (or know why I should care).
Google App Engine with jRuby. Now, this interests me. There’s going to be hackfest on Wednesday night at CabooseConf (a side meeting to RailsConf) that I’m going to want to visit. Of course, Java support on Google App Engine is very preliminary, and there are lots of restrictions. But the speaker says that jRuby on Rails works! Well, except for a few minor issues like no ActiveRecord. Not real practical yet. But very encouraging. There’s a talk at 11:45 AM this Wednesday that goes into more details.
[Side note: I’ve been trying to get our current development application running here in different configurations, and found I couldn’t get it to run under MRI using MySql (jRuby with MySql, or either with SQLite3 worked fine). This isn’t related to the talk, but I found the solution on Google. If you’re running a 64 bit version of Windows, you either need to be running MySql 5.0.x instead of 5.1.x, or else get the libmysql.dll file from an older version of MySql and put it in your Ruby’s bin subdirectory. I don’t want to forget that the next time I wipe and reinstall everything on my laptop, hence this note. It would be really nice if the precompiled gem for MySql gets fixed to avoid this problem, but I’ve noticed that the Windows platform is often not given much attention in the Ruby and Rails communities, so I’m not holding my breath.]
The tutorial has hit a real lull for me. The Java ecosystem is incredibly rich, and layered upon layers. It’s very hard for an outsider like me to keep track of the 27 billion different kinds of tools out there, and we’ve been talking for about an hour about those. From the perspective of a Ruby person wanting to leverage some of that Java stuff, well… yawn.
We’re wrapping up now. There was a lot of value to me in the first half of the talk, but not in the second half. And I don’t think it’s just me. It seems like the speaker got really bogged down at this point. Overall, worthwhile, but it could have been even better.
June 2, 2008
RailsConf 2008 has made most of its presentation materials available for free download.
Google IO is beginning to make videos of its sessions available.
A lot of this stuff is really great, well worth your time.
RailsConf is over now. It ended on a strong, though short, day. For me, it began with Obie Fernandez of HashRocket (and author of The Rails Way) showing us all the “worst rails code you’ve ever seen.” I was worried that I wouldn’t follow the talk because I’m not yet as far along on some planned Rails projects as I had expected, but the examples were clear, he explained the issues simply, and showed the proper approaches.
Rick Bradley of OG Consulting talked about “waxing ballroom floors on the Titanic,” stories about the challenges of doing Rails work “in the enterprise.” The best part for me? The “Can’t Chart” that shows all the organizational impediments to actually achieving your goals.
Adam Keys of Five Runs gave a very personal talk about failures, and how he’s learned from them and changed as a result. An interesting talk about the examples and maturation in general.
And my final session at the conference was Chris Selmer of Intridea, and Josh Owens of the Web 2.0 Show, telling us about Rails Rumble, a contest where teams of up to four people had 48 hours to build and deploy an application. It sounded like a lot of fun, if you don’t need sleep.
The official conference closing was a keynote panel of the core Rails developers. It was low key, but interesting to hear them all together.
June 1, 2008
After lunch, I attended a Lightning Talks session. These are always interesting, and show the momentum Rails has. Then I went to another vendor presentation, this time on CodeGear‘s 3rd Rail IDE. And it was again a very worthwhile session. RailsConf or O’Reilly (or both) has really figured out to give vendors a platform that adds values for the attendees, and I really appreciate that.
I am not a fan of IDEs, but the talk succeeded in selling me on 3rd Rail, at least to the point of giving it a serious try. They gave away fully licensed copies to all attendees, so I won’t even have a time limit on my use. 3rd Rail is built on top of Eclipse, like so many IDEs today. The last time I tried Eclipse it was just too slow for me to stand, but like any successful open source application, it just keeps getting better with time, so I’m hopeful.
My last session of the day was Metaprogramming and Ruby Internals for Rails Developers, given by Patrick Farley of Thoughtworks. Unfortunately, the talk was a total train wreck, probably the worst I’ve ever seen. Not because of the content or presentation of it, but because of technical problems. A particular slide apparently crashed his PC—twice!—and he took at least 15 minutes getting going again on a colleague’s PC. The subject was too complex to just talk about, so he didn’t really have any other option. But from now on, I’m going to make sure that any presentation I give is on my PC, a USB key, and at least one colleague’s PC before I start.
The day closed with a keynote from Kent Beck of Three Rivers Institute. He told stories about the major things he was a big part of (like Extreme Programming) and how each one took twenty years to really set in. It was dry at first, but when he settled in he loosened up and was very entertaining as well as interesting.
Our group ended the day with a big mistake on our parts: we went to dinner downtown. Oh, the dinner at Huber’s Restaurant was very nice, but what we didn’t know was that last night was the annual Starlight Parade, about two blocks from the restaurant. The Max rail was completely packed, so we took a cab. And when we got near the restaurant, took ten minutes to go a block. We had a reservation for dinner, so we got out and walked on. Good dinner and an interesting historic restaurant:
But then had a big problem getting back. The trains were running very slow, and when they finally did arrive, they were too packed to get on. (Actually, they had room in the middle of each car, but people standing near the doors blocked the way there, so no one could get on.) There were special shuttle buses about a block from the Max stop, which went right to our hotel, and once we found that we were fine.
May 31, 2008
If you have large session rooms, you need more than 10 minutes between sessions for people. If you have only 10 minutes per session, you need to be sure that speakers end on time. If you let speakers run late, you have to let people in before he or she finishes. Otherwise, you get a mob:
When you know a room is going to be absolutely filled, why do people always sit in the aisle seat of an empty row, requiring everyone to climb over them? You’re only committing to staying an hour, folks. Go ahead and risk sitting in the middle!
The opening keynote was by Jeremy Kemper of 37Signals, who is a leader in developing Rails. He talked about all the improvements in Rails 2.1, which he announced would be released later today. If I were already a deep user of Rails, I would have found all the details fascinating and exciting, but I don’t have the context to appreciate all of it.
My first talk of the day is 23 Hacks, by Nathaniel Talbott of Terralien. He says we need to hack, not just work on practical things. “Musicians spend a lot of time playing music nobody else would want to listen to.” To stretch themselves, to learn, for the joy of it. The same applies to software development; there is value in “valueless” software. He then demonstrated 13 hacks, and asked the audience to suggest 10 others to make 23. An inspiring talk, ending with an exhortation to us to go hack something soon.
My second talk is Advanced Restful Rails by Ben Scofield of Viget Labs. He started the talk by praising the value of constraints, referencing poetry and classical music. Constraints free you to focus on the smaller set of unconstrained options, letting you be creative and productive. He then covered the material well, but I didn’t learn much new because I’ve been reading so much on this topic already.
The economy as a whole might be slow, but the Ruby on Rails sector of the tech economy seems to be on fire. One measure is how much money vendors spend on t-shirts at conference like this one.
Back in the late 90s, I remember a relatively small O’Reilly Perl conference where about two dozen different vendors were handing out t-shirts with abandon (Sun was giving handsful of OpenOffice shirts to each person, instead of one shirt at a time). The next year, after the tech bubble burst, not a single free t-shirt.
This year at RailsConf, t-shirts are back. I think there are six vendors giving away shirts, and most of them are pushing them on anyone who even walks near their display, even if they already have a shirt in their hand.
Consider this a leading economic indicator
Today was my first day at RailsConf in Portland.
We started the day with a keynote from Joel Spolsky. He gave a very entertaining talk, with good visuals and a lot of jokes. The theme was on what makes software good, with a lot of analogies to architecture, fashion, and even sociology. He’s written about all of this before, in bits and pieces.
My first two breakout sessions weren’t a great start to the conference. John Lam gave a talk on the IronRuby project, where Microsoft is porting Ruby to run on .Net and in Silverlight. The topic was very interesting, but the talk didn’t give any background, and was full of acronyms and jargon specific to either Microsoft or the IronRuby project, and he never defined any of. The second session I attended was “10 Things I Hate About Web Apps” by Micah Martin, which was billed as being about a new open source client-side tool that would eliminate all those bad attributes of web apps. Well, the tool is Limelight, and it eliminates web app problems by not being a web app. It’s a new client that runs on JRuby (Ruby on the Java virtual machine), and is conceptually similar to Flash or Silverlight. I’m more interested in standards-based web applications for now.
Things picked up for me after lunch (which was a real break, unlike at Google IO, with decent food and a good job managing serving and seating so many people). First, I deliberately attended a session that was effectively an infomercial for a conference sponsor’s product. I was skeptical about this track, but the talks were clearly and honestly labeled, and this one was interesting. Guy Naor of Morph Labs showed off Morph Appspace, a free Rails hosting environment with good deployment tools. It was all hands on and live; there were a few glitches due to typos and such, but everything worked and worked well. I’ll probably give the product a try. And I think it’s cute that they registered their domain in the Philippines to spell “Mor.ph”.
I closed the day by attending two sessions each absolutely jam-packed with people. Neal Ford of ThoughtWorks talked about Design Patterns, and how a lot of the existing way of looking at them is obsoleted by languages like Ruby. His slides are available for download. And Ryan Singer, a web designer at 37 Signals, gave a great talk on how designers and programmers can work as a team, instead of effectively having a wall separating them. His perspective as a designer, instead of a programmer (like most of the attendees) gave us all a fresh look at things, and the audience really responded to him and his talk.
So, even though the first few sessions seemed a bit weak to me, the conference as a whole is shaping up to be quite worthwhile.