“When frameworks go bad” or “Why I left Java for Rails”

Several years ago I ran across a discussion on The Joel on Software Discussion Group about the ridiculous state of web frameworks as told via the metaphor of a guy needing a simple hammer. Rather than walking away with a hammer, which is all he really needs, he walks away with a “general-purpose tool-building factory factory factory” to construct his one little hammer.

Why I hate frameworks

I sent this out to the others here at Integrum and Jim Jeffers responded with:

Aren’t these frameworks he’s referring to just a set of suggested design patterns to apply to your project? I don’t really view them as factories. I’m not sure I understand because the framework isn’t really a factory in my view. The application is the factory. So either way you are building this ‘factory’ so to speak. I guess I don’t understand can you explain his point better?

So I wanted to expand upon the original ideas and why I believe Ruby on Rails is the preferred agile platform.

I believe the frameworks he’s referring to are largely the product of the Java community over the last several years, say since ~2000. The first proper Java web framework was Struts, which, for the time did a pretty good job of simplifying web development. The problem was every Java developer who ever dealt with struts thought, “hey! I could do this better,” and proceeded to write their own framework on top of other peoples’ frameworks.

In this case I believe the argument is against having a web framework that tries to be everything to everyone. Using design patterns is very much the appropriate answer; I use them all the time. The problem is when they are reused and rebuilt into everything from the ground up. If you look under the hood of most Java frameworks they are a cascading nightmare of factories, abstract factories, abstract factory singleton flyweights, and on top of all that they have to be genericized [sic] to plug into any conceivable web app and be fully configurable because that’s a “best practice”.

Rails is in a sense the opposite of this conglomerate. By re-writing the idea of a web framework from the ground up in a highly opinionated way using a language that lends itself to very powerful semantics they got away from the “best practices” the capital-E-Enterprise community set forward. Rails, at least to the best of my knowledge, isn’t cluttered with these terrible, incomprehensible overly generic object factories, mostly because the choices were made sensibly for you. The single ORM tool choice of ActiveRecord is a shining example. Better yet, think of it this way: the JBoss Seam framework in Java (last time I checked) was a ~102MB download not counting the JDK (70MB) required to execute it nor the JBoss application server (95MB) required to power it- now consider the Ruby interpreter + Rails and all dependencies are less than 15MB.

Why do we need 200MB + of software to write a hello world app? Why should developers need to write and maintain thousands of lines of XML to plug overly-generic objects together just to make them work AT ALL? Short answer: we shouldn’t because we have smarter options available. Just because it’s the way we’ve always done it doesn’t make it right. I want to make even clearer the fact that the Java developers who designed these systems are not ignorant or needlessly complicating things- they are truly attempting to create the most simplistic and flexible system possible. They just have bad tools in a cumbersome language.

For an example here is the Java Spring reference manual. The tag line of the company that managers Spring is “Weapons for the war on complexity” … this is one of the SIMPLER options, and Yes, you do actually need to know most of this document to create a real-world web app with Spring:
Spring 2.5.x Manual

For a second example, here’s the Quick Start guide to the JBoss application server:
JBoss Application Server quick start

Hopefully that helped contextualize that article. Or at least gave you a laugh that you don’t have to deal with enterprise dogmatism like this and just type “mongrel_rails start” when you want to get going.

What are your thoughts? Maybe you too have crossed over from Java to Ruby on Rails and have opinions or horror stories. Feel free to share them, we’re looking forward to feedback!

Step up to the mic.

Your email address will not be published.