 An early contender for this year's Most Unexpected Port of the PureMVC Framework Award (MUPPFA) has just been released! Jake Dempsey, author of the port to Ruby, was sufficiently impressed with his co-worker's port of PureMVC to Objective C that he thought he'd give it a whirl in one of his favorite languages; Ruby. The result is one of the most approachable and easy to work with ports yet! As with all PureMVC Ports, Demos and Utilities, the repository and wiki are hosted on PureMVC.org. and you can download code here if you'd like. This site will be the official source for the latest project information and forums. Additionally, a project has been setup on RubyForge, to allow installation of the source code and docs with a minimum of muss and fuss. So, if you have Ruby and RubyGems installed you can have it on your system and available to your code with just three words on the command line. Sweet! Not knowing Ruby, I was pleasantly surprised at how easy it was for me to get things working. Jake has also ported the Framework Unit Tests, which is always a plus in the confidence department. Just getting them to run and tell me every thing passed was a real shot in the arm. Then, diving into his port of the classic AS3 EmployeeAdmin demo for Adobe Flex, I was quickly able to do a few refactorings to tidy it with the standing best practices here, and as quickly as that, Ruby felt like a comfortable pair of jeans. It's a simple, beautiful language and I'm pleased to finally make it an aquaintence. Thanks, Jake!
Being a developer in another technology silo who has been interested in Ruby but not had time to dabble in it, the Ruby language is inextricably associated with Rails, the full-stack MVC framework for building web applications. You rarely hear one mentioned without the other. I have always assumed that learning Rails would have to go hand in hand with learning Ruby if I wanted to get anything done. And to be perfectly honest, what I've seen of Rails looks really simple, as does what I've seen of Ruby. So, many will, I'm sure wonder what the use of another MVC framework for Ruby might be. For those who feel the need for a " Why do we need PureMVC_Ruby when we already have Rails?" discussion, please see this pat answer that stands for any port where there are contenders. For those who would simply like a better understanding of how the two stack up (myself included), I asked Jake for the low-down, and here's what he had to say: Rails is built to be a full stack for building web applications. Rails is the collection of libraries:
- Active Record is the object-relational mapping (ORM) layer that connects business objects (models) to database tables. It is an implementation of the Active Record pattern described by Martin Fowler.
- Action Pack is the component that implements both the view and controller portions of the MVC architecture. The controller part handles incoming requests from the user's browser and routes them to the correct method of a controller class. The view part builds the response to send back to the browser using a templating system similar to that of ASP or JSP.
- Active Resource is the component that allows you to talk to external restul interfaces and the results are mapped like AR models.
- Prototype is the component that implements the Ajax, drag-and-drop, and visual effects within your web pages.
- Action Mailer is the component that handles the sending and receiving of email.
- Active Support is the utility component that extends core ruby classes and provides some useful tweaks.
So really, the core of rails is ActiveRecord and Action Pack. The prototype library can be exchanged for any javascript framework. I personally use JQuery on my rails projects. All of these are just gems that can be used without "Rails". I think that when most people say they are using rails they are probably using the ActiveRecord/Action Pack combo to create web apps and are probably using Prototype for their javascript. Of course if they are mailing they are using ActionMailer.
In comparison, the PureMVC Ruby port doesn't take away from any of the great work which combines to create the Ruby on Rails stack. I personally would use Ruby on Rails for a web project, because that is where it shines. Rails is built for the web. I wanted to work on building a desktop application in Ruby. There are tools which will allow you to build rails apps for the desktop, but they still web applications using html/css/javascript. I wanted to structure an application much in the way I do my rails apps using MVC and bring over some of the same ideas that I had used in rails. Porting PureMVC to Ruby gave me what I was looking for. I was able to build the Employee app using Ruby, WxRuby, and the PureMVC Ruby port. When looking at the codebase it was easy to follow because I had become familiar with the working environment of PureMVC and it seem to fit nice.
My hope is that folks would want to bring Ruby to the desktop and build desktop applications. How cool would it be to build Ruby desktop applications and your customer not have a clue its ruby. You could even still use ActiveRecord (or other ruby orms like DataMapper) and ActionMailer. I think macruby is really going to help with that and I think the PureMVC Ruby port can help create a friendly structure to do it in.
• PureMVC Framework for Ruby
• Ruby Unit Tests • Ruby Employee Admin Demo |