The school year has started again, in fact we’re already a month into it, and I’m still here working as part of my 2nd co-op work term well away from all the glamour and action of the school environment. Activity with SIFE Ryerson has started again and with my separation with the day to day activities of the group, I volunteered to take over the relaunch of the SIFE Ryerson website. This was a good project that I was able to do on my own schedule, that only mildly required interaction with other members of the team. Most importantly, it was also the best opportunity for me to get my hands dirty in CakePHP. Working with CakePHP on a site like this from the start was the best choice to really start learning the framework; it was fairly small, it had few requirements, and I had a good deadline to work with.
With working on it on a day to day basis, concepts in Cake started to become familiar in my head fairly quickly, and at the end of the project the framework has become much more comfortable to work with. I have a few thoughts on what it was like starting with CakePHP.
Firstly the one thing I think no other framework but the Django framework currently has is the functionality to define model information in the class declaration, though it does seem to be something that some Cake users are looking at. Having all the fields declared in the class made so much sense and was a convenient point when using Django that at first, I was even surprised that Cake wasn’t made to work the same way, afterwards I found out that that wouldn’t have been possible as Cake was designed after Ruby on Rails. The wonderful part of model definitions coming from the class is that Django also has a function of generating all the SQL code necessary and to create the database tables and their relations necessary the models.
It also makes the relationships between models and having an overall picture of the models clearer. All the validation conditions, model functions, database rules are easier to visualize being in the same location. This would be very important when working with other developers to help them understand the models or in a project that is be handed down to new developers to maintain, such as the SIFE Ryerson homepage will be.
I visited the CakePHP Bakery often over the course of development for help on form validation, the email component, and authentication. It’s a nice site, though it always feels unorganized when I try to browse through it to find help on a specific task. Often when I was searching through the bakery I got frustrated and was thought to myself why couldn’t the CakePHP website just have a documentation section that thoroughly covers the framework. Compared to the documentation on the Django, Code Igniter, and Symfony websites, cakephp.org has some restructuring to do. I should be able to look to the projects’ homepage as the first source to find most of the content I need, and then as a compliment to that look to other resources on the web, especially when as a beginner. I am going to note the fact that the SIFE Ryerson homepage was built using the 1.2 development version of the framework making a lot of the current documentation on cakephp.org not very helpful
A big plus with CakePHP that I’ve found is just the fact that being written in PHP makes setting it up a snap as compared to the work I had to go through last summer in setting up a Django environment on a server. That work involved linking folders, modifying ‘.htaccess’ and ‘.bashrc’ files on the server, permissions, python processes, apache settings, and involved requesting permissions manually from the web hosting provider to be able to do all of that. Though Django ready servers are definitely more of an option now then they were a year ago. On a separate note, measuring productivity gained by easier implementation against development productivity over the life of a project is something that should be looked at closely.
Another initial pain that CakePHP caused me was the work involved in writing templates. Here’s a simple example in looping through all the values is a list in Django:
<ul>
{% for athlete in athlete_list %}
<li>{{ athlete.name }}</li>
{% endfor %}
</ul>
and in CakePHP:
<ul>
<?php foreach ($athelete_list as $athelete): ?>
<li><?php echo $athelete['Athelete']['name']; ?></li>
<?php endforeach; ?>
</ul>
For me Django wins in all regards, it’s more readable, and it also causes less pain my fingers from typing the more complicated PHP object syntax. After a week though this becomes less as an issue because I’d only actually type out all that code so many times.
I’m happy with the results of the website and the site is in a pretty complete state at the moment. Launch date is schedule for sometime after thanksgiving. I can’t deny that in the future once I require more from the framework it will be capable of providing me with what I need, as well as the resources to teach me how to do it. Though there might be more trouble in finding those resources then I would hope for. Note again I’m also working using the CakePHP 1.2 development version, but why there’s no one place with organized information on using it I don’t know (see the Django Documentation for a good example of a thoroughly documented development version).
I talk about the beginner focused documentation for CakePHP as an issue because I would have to think that with PHP being the most popular web language, and with what there are so many frameworks being developed, that whatever framework makes it easier for the new user to use and get started developing would gain a great lead. It surprises me that there is this issue, and at the same time CakePHP is many places represented as always placing in the top 3 among PHP frameworks. Given the scope of CakePHP.org and the Bakery, I could even see something like a new micro-site or first party tutorials focused on new users be something that CakePHP would benefit from. And without going too much into another topic, I think CakePHP website needs to be updated and some design changes need to happen.
If ever a Django inspired PHP framework happens to come along make sure to let me know, and if there’s another good source for CakePHP information make sure to include it in the comments!
