Sunday, October 21. 2007
Recently, I've started a project and selected CakePHP as the framework I should build it on. I was somewhat familiar with Cake and MVC, so starting up wasn't such a big problem, but (as with many other "magic-based" frameworks, I guess) I quickly ran into trouble:
- findBy<Column> method looks nice, but the problem is that you can't control the order in which the related table results are shown, so for example if an user has many posts, there is no way to order those posts in descending order by date, so it's useless, you've to write your own SQL for that, or, maybe try using findAll() method, but this kinda defeats the purpose of findBy, doesn't it?
- findAll() and findBy<Column> doesn't seem to return an array formatted in the same way, so it was impossible to use the same view element for different actions.
- Writing
$user['User'] seems redundant, doesn't it? Maybe there is a reason for this, but this quickly doubles the amount of PHP code in the templates.
- There should be some separation in Session->setFlash between error messages and pure information. I'm sure people would like to display form validation messages in red and simple confirmation messages (like, "login successful") in another color.
- Scaffolding - very useful when you just start your project and are creating the tables / models. Just one small warning here: don't use bake.php to create all your controllers / views because you'll soon end up with controllers that do all the CRUD, the problem being that you might not want to allow the user to do a delete (for example, delete tags associated with a blog post), so when you'll finish your project, you'll have to start searching through the controllers for methods that are not required by your web-app, and if you miss one, you might expose some sensitive information / methods to the users (hackers?) out there.
What I really liked was:
- How routing was done. I was quickly able to create SEF urls.
- Impressive number of custom components for pagination, tagging, validation, etc.
- Real rapid application development (RAD). You can quickly create really got applications.
To be continued...
|