Merb: The Key to Enterprise Ruby?

Merb, the newborn MVC framework for the Ruby scripting language, is going to be the key to getting Ruby accepted in the enterprise, according to core Merb developer Matt Aimonetti.

"Merb addresses the enterprise concerns about cost, adaptability and scalability," Aimonetti told attendees at the recent QCon Developer Conference in San Francisco. "It's free, totally open and it's the fastest Ruby framework we have right now. And you don't need to fight with it to get it to do what you need."

Merb is an open source framework written in Ruby and offers an alternative to the Rails framework that has made Ruby so popular. Both are Model-View-Control (MVC) frameworks, but Aimonetti said Merb's modular architecture is going to make all the difference.

"Ruby has great momentum right now," Aimonetti said. He pointed to a growing list of companies betting on the language, including Gemstone, Sun Microsystems (JRuby), Apple (MacRuby), EngineYard (Rubinius), Microsoft (in Silverlight) and the NetBeans IDE, among others.

According to Gartner, about a million developers claim to be building applications with Ruby, and Rails gets much of the credit for that number. Ruby was originally developed in 1993, but its relatively recent rise in popularity can be linked directly with the birth of Rails in 2005. Rails is a full-stack framework for developing database-backed Web apps following the MVC architecture.

During Aimonetti's conference session, entitled "Merb: When Flexibility and Performance Matter," he made the case for Merb as the Ruby enterprise-buster. Among other capabilities, he pointed to Merb's ability to allow for the development of "slices," which serve as standalone, miniature apps that can be "mounted" inside other applications. These smaller applications allow developers to replicate common developer tasks with less overhead and a higher degree of customizability, Aimonetti said.

Also, the Merb architecture is object-relational mapping (ORM)-agnostic, giving coders a wide range of choices among JavaScript libraries and template languages, he said. Additional features can be plugged into the framework, too, using RubyGems, a packaging system that provides a standard format for distributing Ruby programs and libraries.

"Merb is being developed from scratch with the knowledge of all the great stuff that Rails does well, but also with the hindsight of knowing what it didn't do so well," observed Ola Bini, a Swedish developer and Ruby guru currently working for conference co-sponsor ThoughtWorks. Bini is the author of Practical JRuby on Rails Web 2.0 Projects: Bringing Ruby on Rails to Java (Apress, 2007). He was one of the core developers of JRuby, a Java implementation of the Ruby interpreter.

"Merb is not revolutionary, but rather an evolutionary next step," Bini told ADT in a post-session interview. "But it's definitely cool with lots of benefits compared to Rails."

"But remember that Merb is still largely untested compared with Rails," Bini hastened to add. "There's a large difference in the size of the communities and the documentation. And Rails has loads and loads of plug-ins, which haven't yet been replicated. So you do get some real benefits from staying in the Rails fold."

What, then, is the initial appeal of Merb?

"It's the modularity, the cleanliness of the code...lots of things," Bini said. "Actually, it's a very good example of how you should really write Ruby code. If look at the internals of Rails, it's not a good example of Ruby code. That's not how you should write Ruby code to make it maintainable and so on. I wouldn't recommend that anyone learn Ruby by reading Rails source code, but I'd definitely say go and read Merb."

Bini expects the coming versions of Rails to pick up on the things that Merb does well. "It's definitely an exchange of good ideas," he said. "Choice and competition: always good."

QCon is a low-key, bi-annual developer conference "organized by the community, for the community." The first conference was held in London in March of last year, with a follow-up show later in San Francisco. Last month's QCon San Francisco was sponsored jointly by the InfoQ online developer community and the Denmark-based ISV Trifork, organizers of the 10-year-old JAOO conference series. QCon San Francisco drew an estimated 400 attendees. Another QCon event is planned for London in March 2009.

About the Author

John K. Waters is a freelance writer based in Silicon Valley. He can be reached at [email protected].