Content feed Comments Feed

Managed Mayhem

More Than 99 Billion Cats Herded

Archive for the ‘cakePHP’ Category

Convention over Configuration

Posted by Jim Rising On February - 10 - 2010

I’m noticing a trend… and I’m liking it. I’ve been working with cakePHP … and they have a wonderful way of causing you to want to name things a certain way so that you don’t have to fiddle with a bunch of configuration files… Coldbox (which I love!) has the same thinking behind it… but still has a nasty mess of xml files that you wind up needing to hoark with.

In CakePHP … your database tables, models, controllers and views are all linked by the naming convention that is used…

  • Database table: “dogs”
  • Model class: “Dog”, found at /app/models/dog.php
  • Controller class: “DogsController”, found at /app/controllers/dogs_controller.php
  • View template, found at /app/views/dogs/index.ctp

It even has a cool little ‘inflector’ class that will take a string and pluralize it for you if you need help:

Example: Inflector::pluralize('dog') returns “dogs”.

Neat.

I remember what a pain Fusebox used to be … one of my biggest complaints about the framework was that it was so laden with XML configuration files everywhere!

Coldbox still has quite a bit of setup you need to go through using XML, but similar to the way that Fusebox has transitioned over time (I started with Fusebox at version 2!)… all of your models, views, and controllers (handlers) are CFC object based rather than dealing primarily in XML.

About Us

"Managed Mayhem" is a software project development and management blog maintained by Jim Rising. Jim Rising is an Adobe Cold Fusion developer who lives in Murfreesboro, Tennessee with his wife Melissa, their son 'Haven', cat ‘Rusty’, and dog ‘Güenther’. He currently freelances from home.