Comparing Struts to Action Pack/Railties

Nicholas Mommaerts is a Java programmer that “…spend[s] 8 hours a day programming with Struts in a big company”. After becoming interested enough in Rails to do his blog in it, he also got interested in comparing his work environment to his newfound fun environment. So he went ahead an made a comparison analysis between Struts and Action Pack/Railties available both as a PDF and a 4-installment HTML series (1, 2, 3, 4).

Do read the full comparison, but here’s the conclusion:

Rails eliminates a lot of the boilerplate code we see in a normal web application, it adds just enough to the default stack of web standards to make programming a web application almost enjoyable (or boring). It relies on configuration through convention, but let’s you override where needed. It’s lean, self-contained, uses only one (great!) language and encourages testing. Rails is flexible because it remains so simple, so unobtrusive.

Struts eliminates boilerplate code only by replacing it with it’s own. Struts is a big, fat, hairy monster with which you have to fight constantly when programming. It is very flexible but this comes with such a high cost it makes you wonder if it’s worth it.

Rails beats Struts down, kicks it in the groin and leaves Struts crying for it’s mama.

Jamis Buck presents Rails at Utah JUG

Jamis Buck did a presentation of Rails for the Utah Java Users Group two nights ago. He has made the entire show available online including the Terminal videos used to show the programming. The presentation was given in between one about JDO and Howard Lewis Ship’s one about Tapestry. Here’s what one of the spectators noted:

As a witness to the event, I have to say that the presentation went quite well. This is what I learned from each speaker:1) JDO is losing popularity to Hibernate, 2) How to build a entire CRUD app in 40 min using Rails, 3) How to build a single login screen in 1 hour using Tapestry. Hmmmm… kinda indicative of the tools presented. :)

Congratulations on the good show, Jamis!

Nearing a tipping point for LAMP with Rails

Tom Purl believes we’re getting near a tipping point for LAMP in the enterprise and that the missing piece, “…this bridge appears to be Ruby on Rails”:

So in addition to being able to use LAMP and increased productivity, why would large companies wan to use Ruby on Rails? Well, for starters, large companies are already using the MVC framework extensively with J2EE and .Net, so another slightly-different framework wouldn’t be too hard to swallow. Also, Ruby is is an object-oriented scripting language that shares many features with Java an C#. It certainly has its differences, but nothing compared to the differences between Cobol and Java or VB 6.

Commercial training in Rails

Tobias Luekte has had great success introducing newcomers to Rails. He provides tutoring sessions with hand-holding, sing-alongs, and all that good stuff that makes you really get what’s going on much, much faster than picking everything up on your own. He’s now offering this service to the public at large, so if you just got into Rails and want to purchase some focused training to help you get up to speed faster, Tobias is your man.

A few quotes from people how has had the pleasure so far:

“Tobias’ deep knowledge of the entire Rails system is what finally gave my company the confidence to go ahead with this project. His wisdom and insight into such things as database setup helped immensely. He has a great way of walking through real-world situations instead of merely abstract or simplistic scholastic examples.”
— Derek Sivers,

“Tobias’ support and mentoring has been invaluable — why spend a few hours hacking away with trial-and-error code when someone with real experience can solve the problem and clearly explain it to me in a fraction of the time?”
— Justin French,

The training can even be performed remote using VNC and Skype/phone. Read more at Leetsoft.

Tobias sets up Trac for Typo

Tobias Luekte has set up a Trac site for his Typo weblog engine. Typo has a slew of neat features including:

  • XML-RPC backend implementing the metaweblog api. MarsEdit and other desktop clients work great.
  • Comments
  • Textile by way of RedCloth
  • fulltext search
  • RSS2 and Atom export
  • CommentRSS export
  • Some use of caching and sweepers

So whether you’d like to run it or not, you’ll probably do well by having a look at the source.

Routing now available in beta gems

Routing is the new name for what was previously known as Directions. The move of responsibility from mod_rewrite and into Rails. This project is now good enough to have moved off the branch it was growing on and into the trunk and beta gems. This also means, however, that the trunk and the beta gems are currently not directly backwards compatible with existing applications.

We’re going to make sure that the migrating documentation is superb for release, but if you’re too impatient, here are the few steps you need to take on applications that doesn’t use custom URLs (those will be a bit more cumbersome to port):

1. Create config/routes.rb with the following content:

ActionController::Routing::Routes.draw do |map|
  # Add your own custom routes here.
  # The priority is based upon order of creation: first created -> highest priority.
  # Here's a sample route:
  # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
  # Keep in mind you can assign values other than :controller and :action
  # Install the default route as the lowest priority.
  map.connect ':controller/:action/:id'

2. Replace public/.htaccess with:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /dispatch.fcgi?$1 [QSA,L]

ErrorDocument 500 /500.html

3. Add the new independent Active Support library to the default loads. For gem installations, it means adding require_gem 'activesupport' right underneath require 'rubygems' in config/environment.rb. It’ll then look like:

# Require Rails gems.
require 'rubygems'
require_gem 'activesupport'
require_gem 'activerecord'
require_gem 'actionpack'
require_gem 'actionmailer'
require_gem 'rails'

For SVN/tgz installations, it means adding vendor/activesupport/lib to the ADDITIONAL_LOAD_PATHS and add require 'active_support' under # Require Rails libraries. also in config/environment.rb. It’ll then look like:

# Followed by the standard includes.
).map { |dir| "#{RAILS_ROOT}/#{dir}" }

# Prepend to $LOAD_PATH
ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if }

# Require Rails libraries.
require 'active_support'
require 'active_record'
require 'action_controller'
require 'action_mailer'

4. Add ActionController::Routing::Routes.reload somewhere in your config/environment.rb file.

That should be it. More detailed information will follow shortly.