Ruby on Rails: What I Like

I started a short series of blogs about what I like in a number of modern frameworks/web programming environments. This is part of an effort to find what really works in these languages, and to see how best I can port them to ColdFusion. This time around its the king of RAD, Ruby on Rails.

Rails is all the rage these days, so its hard not to compare any framework to the "RoR". Its even harder when lost of frameworks for existing languages are inspired by Ruby on Rails, and try to re-implement things it does in their own language. You know what they say: "Imitation is the sincerest form of flattery." Now its time for me to see what I like.


CakePHP: What I like

I've been doing a lot of thinking about frameworks lately, and about how much work it is to get a MVC/Model2 framework going in ColdFusion compared to in other languages/servers. This lead me to investigate the documentation for a number of non-ColdFusion server/frameworks that I've used, or are popular, and I've been trying to round out a list of what I like and why.

The first installment of this mini-series is on CakePHP. Please remember that while I may have used some of these frameworks, I'm not an expert, so I might be missing the thing that makes that framework cool. If so, let me know that you think the best parts of the framework are, and I'll see if I agree.


IIS vs onMissingTemplate

Several weeks back I was exposed to Python and Django for the first time, and it really got me thinking. While I'm not a huge fan of Python syntax, I really did like the setup for Django, and how it implements MVC. One of the first things that I loved was this little tid-bit for linking up URL requests to views:

from django.conf.urls.defaults import *

urlpatterns = patterns('',
(r'^polls/$', 'mysite.polls.views.index'),
(r'^polls/(?P<poll_id>\d+)/$', 'mysite.polls.views.detail'),
(r'^polls/(?P<poll_id>\d+)/results/$', 'mysite.polls.views.results'),
(r'^polls/(?P<poll_id>\d+)/vote/$', 'mysite.polls.views.vote'),
)

In that block, Django is defining regular expressions that map to Python functions, and defining how to pull named variables out of that regular expression, so that if you requested /polls/23/ becomes a call to the mysite.polls.views module to do the following:

# mysite.polls.views is the module, details is the function
detail(request=<HttpRequest object>, poll_id='23')

Isn't that cool? I'd love to be able to do that in ColdFusion, but it looks like there are a number of hurtles I have to get past before I can make this work:

  1. How do I make ColdFusion get the variables out of that URL path?
  2. How do I make ColdFusion look at a URL that doesn't exist?


Leveraging Popular Frameworks

This contains info from the CFUnited talk on this topic.

This talk covers MVC, Factories, ORM Introducing a quick start application: AppBooster

Domain & Business objects for each Entity.

Business Object (bean) - people, places, and things, the nouns in your system. Data Access Objects (DAO) - read and save objects Gateways - Objects which return queries Service Object (SO) - your API (controllers do not touch BO, DAO, or Gateway) Controllers - talk to your service layer.

Q: Where is validation at? A: In the BO, or the SO.

Frameworks and Software Layers

DB Layer (ORM) Transfer, Reactor

continue later


StackCore

I've come up with a .02 version of warpcore using a Java Stack as the event manager, but from simple testing it doesn't seem to be as fast as the previous version. I'm going to have to narrow this down to creation time or execution time though.

Click more to see the code.


WarpCore

The name's probably already taken, but what the hell. WarpCore is the name I've given to a very simple implementation of an implicit invocation controller scheme in ColdFusion. The concept is simple: some variable is set that contains an event, the WarpCore handles the registration of new drives (controllers), and the WarpCore controls activating functions in those drives.

More Entries