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.

More


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?

More