The 15 Step Rails Code Quality Checklist
The Ruby on Rails Code Quality Checklist is a 15 point "quality checklist" for Rails developers to run against their Rails applications by Matthew Paul Moore. It's a year old, so predates Rails 2.2 and 2.3, but it recently made the rounds at the main social bookmarking sites, and I felt it was worth bringing up.
The first 5 of Matthew's points - in a very basic summary - are:
- Each controller action only calls one model method other than an initial find or new
- Only one or two instance variables are shared between each controller and view
- All model and variable names are both immediately obvious (to a new developer) and as short as possible without using abbreviations.
- All custom "finds" accessed from more than one place in the code use named_scope instead of a custom method.
- A .find or .find_by_ is never called in a view or view helper.
To learn the rest, you'll need to check out his article. He doesn't just list the points. He goes into further detail about every one. A great read.
[ad] Jumpstart Lab is offering Rails Jumpstart, an introduction to Ruby on Rails, on 10/31-11/1 in Washington, DC. Save $30 with code "rubyrow"!
October 4th, 2009 at 9:05 am
100000% agree with this.
I think people talk way too little about these kinds of code quality issues. Reminds me that I should go do some refactoring till that's true for Wikimedia. :P
October 6th, 2009 at 10:55 am
This is a rather poor list.
October 6th, 2009 at 2:47 pm
If you can come up with a better one, I might link to it. Or I'd at least add the link here.