DHHNote 2007

DHH is reviewing the State of the Ruby on Rails Union:

1 million downloads of the Rails gem

hundreds of plugins (at least 600…I wonder how many generators)

10,000 people in rubyonrails-talk Google group (and several hundred in the IRC channel)

jobs looking for more experience in RoR than DHH has (reminds me of the early Java job listings)

most attendees are getting paid in some capacity to write in Rails (I looked around as we raised our hands) vs 1/2 the room at RubyConf a few years ago

lots of books (documentation is definitely key)

Now onto Rails 2.0…

It’s not a unicorn, but real. (But Rails 3.0 will be a pony.) No bomb dropping like last year (*cough* REST *cough*). On the other hand, resources will be more central to Rails 2.0.

Single models can be represented by multiple resources. It doesn’t have to be just the standard 7 actions. It can have related resources as well. This is a good improvement over the way we specify resources today in 1.2. The resource scaffold is now the default scaffold.

Next up, DHH did a quick demo of customizing a resource. Also he demoed the ActiveResource client library which works with resources remotely. Man we’ve come a long way since the Java/COBRA Orfali/Harkey book that was like a phone book that explained how to do client/server apps. I think it shows the triumph of convention over configuration.

ActionWebService has left the building. Rails is not the Switzerland of frameworks (or perhaps you could say its not the Swiss Army Knife of frameworks.) Following Dave Thomas’s suggestion from last year, Rails is slimming down the core and making more things be plug-ins and ActionWebService is now a plug-in.

Current friends of Rails: AJAX and REST. Future allies: ATOM (for feeds) and OpenID. (More from DHH in the next post…)

May 18, 2007. Rails, RailsConf. No Comments.

RailsConf is huge

We’ve got 1600 people attending this years RailsConf (as opposed to around 400 last year.) This sort of reminds me of when Eclipse got popular and the growth between the first and second EclipseCon.

Alright so Chad is up on stage welcoming everyone. He’s encouraging everyone to be good and give at http://pragmaticstudio.com/donate. The message: don’t be overprivileged programming geeks who don’t have to type all the Java syntax. lol

Now Chad is playing out some nice tunes on the ukelele while Rich is telling us about his intro to TextMate (he’s got license #8) by DHH.

May 18, 2007. Rails, RailsConf. 1 Comment.

Streamlined at RailsConf

My tutorials day turned into a Streamlined day. After going to most of the JRuby presentation, I ducked out to pair program some last minute Streamlined improvements with Justin Gehtland. Matthew Bass was with us too working on Streamlined to spruce it up a bit before the afternoon tutorial.

Justin invited Matthew and I to help present and so I took him up on the offer. I was supposed to go to the Rails Routing Roundup but I thought it’d be better to go the Streamlined tutorial to help out and get feedback from the community. Justin is a master presenter so there really wasn’t much to add, but I still had a lot of fun being up there and talking about Streamlined. Matthew also got up and showed some new features as well.

Oh, did I mention that I’m a Streamlined committer now? I’m waaaaaaay behind on my blogging. :) I’ve been doing some work with Relevance and all the projects I work on use Streamlined. So its gotten a lot of love lately since it helps form the foundation of those Rails projects.

We got some great feedback from the audience, which we were pretty happy about and I took a lot of notes. An open source framework like Streamlined really thrives when there’s an active community. From my perspective, what we need to do for 1.0 is to write more documentation, write more documentation, and write more documentation. Not just about the API, but also code examples, information about the team, and some more overview/history. Justin made some new screencasts but probably we could also benefit from having a long article or two as well.

You can already get the Streamlined tutorial slides. After that, please check out the Streamlined blog and the Streamlined wiki to learn more.

May 18, 2007. Rails, Streamlined. 1 Comment.

I’m at RailsConf 2007

I’m at RailsConf 2007 in Portland, OR - its tutorial day. I’ve been really busy with consulting lately so haven’t done much blogging. But I usually am good at blogging while at a conference. :)

Sitting in the “Your First Day with JRuby on Rails” now. As a former Javaholic and current Rails aficionado, I figured it’d be good to get the lowdown on this possible fusion of the two. Plus we all need a better Ruby VM.

May 17, 2007. Rails, RailsConf, JRuby. No Comments.

Tip: Monitor your website and your Rails apps

You probably want to make sure your websites are up, especially your personal and corporate site. Of course you want all your Rails apps to be up all the time as well. It is a 24-7 world we live in after all. Also it will help you monitor your hosting company and let you know if you’re on a bad server or if you should switch companies completely.

So how do you do that? I recommend two options which I personally use. I’m sure there’s plenty of others, so please leave a comment if you’ve had a good or bad experience with website monitoring services.

The first is Montastic. It’s free and built in Ruby on Rails. It will send you an email whenever your site is unreachable and then another email whenever your site is up again. You have to look at both emails to figure out your downtime manually. The site itself is very friendly and you can point it at any URL on your site.

The second is Uptime by OpenACS. It is very similar to Montastic but has a very plain web interface. It also gives you an email on server down and another on server up, but it calculates the downtime for you. You can point it to any URL, but that URL has to return “success”.

April 6, 2007. Rails. 4 Comments.

The best way to understand continuations

I was reading up about Procs due to an interesting error in some code:
warning: tried to create Proc object without a block

So I picked up my copy (and got a nice little workout in the process) of The Ruby Way, 2nd edition by Hal Fulton. It’s a good book for all Rubists and Railers. It had this nice little gem right before the section on Procs:

The best way to understand continuations is to watch the movie Run, Lola, Run (or the original German Version, Lola Rennt.)

Hal also compares it to a “save game” feature. Probably easier to understand among the video-game-playing-and-computer-programming crowd. Nevertheless, I think its probably still worth it to go watch Run Lola Run to improve your understanding of continuations.

April 3, 2007. Rails, Ruby. No Comments.

NOVARUG Meeting next Wednesday - March 21st

I’ve been away at Advanced Rails Studio most of this past week. I just confirmed the next NOVARUG (that’s the NOrthern VirginiA Ruby Users Group for the uninitiated and yes you will have to go through the initiation ceremony - I think there’s a public renunciation of Java and .NET involved…) meeting will be:

Wednesday
March 21
FGM Building in Reston, VA
6:30pm - 9pm
free pizza and soda

Sean Mountcastle will be presenting CRUD and REST Rails development as well as some ActiveResource.

I will be again piloting the East Falls Church Metro to Reston Shuttle. It leaves at 6pm sharp. RSVP me at luis at luisdelarosa.com if you want a ride.

March 17, 2007. Rails. No Comments.

Quick and Clean Rails Code by Chad Fowler - a summary

The last NOVARUG meeting was great. I have been insanely busy since then, but felt remiss not posting anything about it. So here’s a short summary with more details to come as I get time.

Chad gave a great presentation that comes from his recent experience as being a Reviewer of Rails Projects. In short: there’s a lot for all of us to learn as a community to improve the state of the practice of Rails, we need to do more testing and we really need to know Ruby better.

To give his points a little more emphasis, I started to think of them as Chad’s Rules of Quick and Clean Rails:

Chad Rule #0 - Be zealous about testing. Do TDD. A lot of this can be driven from that perspective.

Chad Rule #1 - NO SQL IN CONTROLLERS!

Chad Rule #2 - Think of controllers where you script the interaction between rich business objects. Don’t go above or below that level.

Chad Rule #3 - You should only do 4 lines of code in an action. Don’t include respond_to and don’t include semicolons. Colons are ok however. ;)

Chad Rule #4 - Utilize Association Proxies.

Chad Rule #5 - Use before filters to DRY up your controllers. This is sort of like when you set variables in the setup method of unit tests.
But…when you start inheriting before_filters, you introduce a level of magic which can make things mysterious.
Use this to get around Chad Rule #3. lol

Chad Rule #6 - Make your own language. Create DSLs when you can.

Chad Rule #7 - Use with_scope wisely.

Chad Rule #8 - NO (imperative) CODE IN YOUR VIEWS!

Chad Rule #9 - Hide the ugly things where you don’t have to look at them.

Chad Rule #10 - Use RJS helpers to reduce duplication.

Chad Rule #11 - Blocks (almost) always make it better.

Chad Rule #12 - Implicit coupling and conventions are good.

Chad Rule #13 - Master Ruby!!!

Bonus Chad Rule: Leave. If you can’t change your organization, Change your organization.

Then we had a lively discussion about outsourcing/offshoring and another one about metaprogramming.

Thanks to our sponsors and their gifts that we gave away. And here’s the obligatory Ruby code…


sponsors = {
  :relevance_llc => "Rails for Java Developers",
  :oreilly => "Rails Cookbook",
  :peepcode => "PeepCode coupon",
  :pragmatic_studio => "'I'd rather be on Rails' bumper stickers"
}

assert_equal 56, session[:attendance]

March 5, 2007. Rails. 2 Comments.

“Quick and Clean” NOVA RUG meeting tonight with Chad Fowler!

I’ve been so heads down in RoR development that I’ve been remiss in my blogging… But the February NOVA Ruby Users Group meeting is tonight! Chad Fowler is our guest speaker and here’s what he’ll be talking about:

Rails is all about speed. It has been said that Rails programmers can develop software ten times faster than those programming in technologies such as .NET or J2EE. Rails itself is evolving at the speed of light.

But, to paraphrase Martin Fowler’s RailsConf 2006 keynote, with Rails we don’t have to choose between Quick and Dirty and Slow and Clean. With Ruby, and therefore Rails, we can have both speed and maintainability.

With Rails, the speed comes naturally. As it turns out, the cleanliness often doesn’t. This talk will focus on how to make your application development both quick _and_ clean.

Since we have crazy gridlock around here in DC (no I’m not talking about the government), I’ll be picking up any ‘Rug Attendees at the East Falls Church Metro at 6pm. Email me at luis at this domainname if you want in on the shuttle. I’m already taking one fellow Rugger from Maryland and I’ve got room for two more.

February 21, 2007. Rails. No Comments.

Rcov

I’ve started to use rcov on all my Rails projects. A project I had started working on last year had already been doing it but it didn’t really click in my brain until recently. Rcov is a great code coverage tool for Ruby and Mike Clark has a great write-up on using rcov with Rails plus a sample rake task. It includes a command to open up the generated HTML automatically which I usually do afterwards.

I only have one small tweak to Mike’s rake task and that is to sort by coverage by adding “–sort coverage”. What this does, at least for me, is to let me know what classes really need some testing love. And isn’t that what your Ruby classes need this Valentine’s Day? :)

Here’s the patched rake task (credit again goes to Mike Clark for the original rake task):


namespace :test do

  desc 'Measures test coverage'
  task :coverage do
    rm_f "coverage"
    rm_f "coverage.data"
    rcov = "rcov --sort coverage --rails --aggregate coverage.data --text-summary -Ilib"
    system("#{rcov} --no-html test/unit/*_test.rb")
    system("#{rcov} --no-html test/functional/*_test.rb")
    system("#{rcov} --html test/integration/*_test.rb")
    system("open coverage/index.html") if PLATFORM['darwin']
  end

end

February 13, 2007. Rails. 3 Comments.

Older Entries Newer Entries