It has been a while since I’ve written much about CakePHP (let alone anything on my blog), but I thought I’d update the world with my latest thoughts in case anyone was interested.
I’ve come a long way since I first started using CakePHP. In fact, I’ve now used the product on some fairly high end sites and had really good luck with it. There have been minor quibbles here and there (still revolving around documentation mostly), but I’m now a solidified “Baker” through and through.
I will save you some time looking elsewhere and reading the reviews about all the different PHP frameworks; use CakePHP, it’s the best. In my humble opinion, the only better framework available is Ruby on Rails (which I’d also highly recommend); but if you are stuck using PHP - CakePHP is your best bet.
This framework will encourage (and teach) you to follow through with good web development habits. These skills are both in programming style (using standardized naming conventions, proper variable scope, documentation, et cetera), but also in technical areas as well (proper database modeling, mvc code separation, secure user input validation and cleaning, and efficient function development).
Now that I understand the majority of the tenants of Cake, I can say with confidence that it’s a quality product. 1.2 RC2 solved almost all of the minor/major problem I had with the framework and it seems stable as all get out. Cake will help you use fast, efficient, and complex SQL queries without a sweat. It will allow you to create fancy “web 2.0′ esque” sites using AJAX and fancy doo-dads with ease. It will easily validate your input data without the need for you to much of anything. It provides easy ways to offer web services, shell scripts, and test your code quickly and easily using SimpleTest. …And that’s just scratching the surface. The other advantage is it’s super easy to pull in outside code into your projects using components and helpers. The framework is rigid where it needs to be and flexible in the areas that are key.
In simple terms - “Cake Saved My Life“.
So How Do I Learn It?
You need to learn the basics of PHP first; I think this writeup is an excellent starting point (though I wouldn’t recommend wasting any time with the Zend framework). I’ve seen a few people on the web talking smack about CakePHP, when the problem was that they really didn’t understand PHP.
Once you have mastered the basics of PHP, go to book.cakephp.org and read the whole thing on version 1.2 of Cake (currently RC2); don’t waste your time learning 1.1. You can read it in just a few hours and you don’t have to understand it all at that point.. just try to grasp the basics. If you’ve never worked with the MVC design pattern, then read those sections over a few times until you get it. Then, install it using the specific directions in the book (read it carefully). Now is the time to start using Apache2, MySQL, and PHP 5 if you aren’t yet. I don’t care if you are Windows, UNIX, or Mac… use the products that are the most popular and you’ll make your life easier.
After you get it installed, make up a wild test application in your head and sit down and code it. Don’t worry about making it pretty; just learn how to code it right. Learn how HABTM’s work, learn how automagic form validation works, learn the ajax helper details — learn it all!
So to review:
Dustin’s tips to mastering CakePHP:
- Learn PHP (Don’t waste your time messing with Zend though)
- Read The Book (learn version 1.2)
- Install It (Use Apache2, a recent release of MySQL, and PHP 5… no matter what OS you are on; break your IIS addiction or PHP 4 addiction NOW)
- Create a test site in your head and finish it within a reasonable time frame. Force yourself to finish it.
- Love it
Almost every problem you’ll come across should be answered in the CakePHP book now; so no excuses for not being able to get it going. If you have configuration problems, make sure you search through the Google Group; it’s a vastly helpful resource.
Also, don’t forget to look through the Bakery, you can find a ton of code in there to help you solve common problems.
August 8th, 2008 at 1:23 am
Ignore first one, sorry — something went wrong….
I am sorry to say that I agree with very little contained within this post and read through with ever-increasing confusion as you detailed the reason you find cakePHP to be the best in a large, and in my opinion high quality, collection of PHP frameworks.
Your description is accurate and conveys what cakePHP does but I am entirely opposed to labeling it as “best PHP framework available” and gasp in surprise when you say that the only better web development framework — regardless of language — is Ruby on Rails.
Ruby on Rails is the equivalent of Apple in the web framework family — take a look at the RoR project site and then put an ‘i’ in front of their acronym. iRoR — sexy marketing with enough well written copy to convince many that it is a “must have” or in the case of a framework, a “must learn”. RoR is a very useful but in the same way as an iPod restricts you to using proprietary software and audio formats, RoR has restrictions that doesn’t allow a new user to do too much outside of the framework’s blueprint. It would be a boring neighborhood if all our homes were built from the same schematic.
I’ll touch more on the frameworks in other languages later but for now I want to address some concerns I have with why you believe cakePHP to be so inherently superior.
It is very unlikely that any framework will encourage or teach a user any development principles . The idea of a framework is to take the abstraction away from the client coders so it is entirely possible for a user with 1 week of PHP experience to commence using a framework and never learn a thing about what is happening in the background. The MVC, bootstrapping and Front controller methods of programming would be entirely lost on them because they have always used a framework that sorted it for them.
The next few points you mention here are not specific to cakePHP and in fact, if cakePHP did not incorporate them it would be crossing the line to call itself a framework at all. Naming conventions are just logical to allow a framework access to its many parts through uniformly named components and a featured ORM is not only required by all frameworks, it is implemented far better in Symfony, Django, RoR and Codeigniter. Secure input cleansing is also another part that cannot possibly be omitted from any self respecting framework and cake’s validation inside of models is confusing at best and bewildering at worst.
I have worked on many projects with cakePHP and there are many things that it does well but many many more that it does below par to the point that its disadvantages tilted the scale forcing me to cease using it.
The worst part of the cakePHP project is by far the documentation, both on the framework’s website and within the code itself. It appears that half of the core developers did not deem appropriately commented code important and it is only now that the fully commented packages are beginning to appear. The ‘manual’ for the development version is still missing a majority of the documentation for anything deviating from the pick-up-and-play parts of the framework and the IRC rarely yields help beyond a request for a paste-bin and perhaps a link to a rudimentary manual page.
Another completely valid concern I can raise is the appallingly long time that version 1.2 has been beta and now finally being offered as a release candidate. The fact that the beta and RC process continues so long is not the issue, the issue is that the core development team and support areas basically dropped continued support on the much less useful and feature-rich version 1.1 and it is just not conceivable for enterprises — looking to deploy solid applications — to use a framework that is not stable.
It is safe to say that cakePHP is a quality product. It takes many hundreds of hours and many experienced developers to put together a framework. It is not so safe to say that cakePHP is best.
Cake does not help you write intelligent queries, it makes you use a ridiculous amount of arrays to get limited amounts of data. The main problem with the way that cakePHP interacts with databases is the lack of flexibility and the eye-wrenching hard time you will have finding documents to inform you of any configurable options you have.
As for ajax — a pickling point for me is that the ajax features are implemented using prototype with no options to use another library. The 1.2 ajax features are virtually undocumented and if you have no experience with prototype.js you are in a bit of strife. During my development time with cake, it was much faster for me write custom ajax handlers using either my own javascript or a library of my own choice.
Again, it appears that you have not used many frameworks because all of them allow almost all of this.
I have been developing applications with PHP for nearly a decade, I can safely say the reasons for my cakePHP dislike is not due to lack of PHP knowledge.
Symfony, is by far the best PHP framework and I can understand why many inexperienced PHP programmers would prefer a framework like cake which is kinder on those using sloppy coding practices. Symfony implements intelligent use of .yml and x.xml files and understands that when you are using a framework and have to write code — it should be business logic, not drivel to get a view to work — the configuration files get the framework up and running allowing you to quickly snap your logic together.
I have heard this bold declaration from many people — not exactly in relation to cakePHP but essentially in relation to the first framework they experienced. If you have not developed large applications in a modular, MVC or OOP environment, it is a revelation to have all that work done for you and to see things just work…. The statement from above should be
You may be lucky enough that the framework you first use is the best but you shouldn’t assume that the revelation your first brought you will automatically be the best…
Now onto why RoR should not claim the first spot on web framework leaderboards…
RoR has a few things going for it. One large part of that is that RoR was one of the front-runners in rapid development frameworks. It’s quick, it’s “magic” and it has a pseudo big business marketing team behind it but it is limiting, hard to re-use and hard to get set up on a server. In my opinion, RoR is more glitz than guts and this is fine for people who want cheap web thrills on the cheap.
My heart, my development soul lay to rest at the feet of Django — the massively well documented, passionately well supported and incredibly versatile and modular Python framework.
I have been coding in Python for some time and anyone else reading this who has used Python will completely agree that it is a sexy, sleek logical language. Django takes the clean Python bull by the horns and harnesses it for deployment on the web. You first Django application may take a little while to set up but the enforcing of modular design and Python’s intolerance of bad scripting practice means you *will* learn how to develop smartly and along the best practice lines.
Of course this is all relative to where you stand but I wanted to say that you have not convinced me anything more than that cakePHP is another web development framework.
August 8th, 2008 at 2:50 am
hi Dustin, nice write-up. I think I have been using Cake as long as you now, and feel really happy that I chose the best PHP framework. There has been excellent growth in the communtiy in the last year (there are blogs everywhere now) and the serenity of the dev team in bringing cake to a stable, sustainable level is amazing achievement.
It always had potential, but I think it has been realised now and it is simply outstandingly useful.
A couple of other things for a newbie to get going with it - join the google group and subscribe to the email daily digest - just read it when you get a spare five minutes and you will quickly get familiar with aspects of Cake.
Also, the David Golding book just released is worth getting imho. The other book is OK, but I found not too in-depth.
The bakery is nice to have a look at others code - running through the odd tutorial and looking at the way others use cake will give someone a handle on it.
And finally the blogs I mentioned - there are about 10 essential ones now, and whenever you google cakephp and something then add the RSS for any tips you find. Thats how I got your RSS a while ago I think!
cheers
Luke
August 8th, 2008 at 8:50 am
Why do you say you wouldn’t recommend wasting time with Zend Framework? Some of our components address functional areas that CakePHP hasn’t yet, and it will work very well as a vendor library. I’m not trying to change your opinion about ZF- just wondering what is behind such a broad recommendation.
August 11th, 2008 at 8:31 pm
Rakuli, you obviously have a lot of experience with PHP frameworks so it was good to read your comment. However, I have developed in Ruby and Rails for about 3 years (and PHP since 1998-ish) and I don’t find the rails framework to be very limiting at all. As a long-time PHP dev (and a perl dev even before that) I found the ruby language to be much easier to write, and write well in, than PHP. I still use PHP for some projects (and Ruby has plenty of room for improvement) but I think it’s unfair to characterize it as just “sexy marketing.” The Screencast was certainly sexy, but if it wasn’t backed up by an easy-to-use system that actually allowed you to produce something useful I don’t think it would have taken off as it did.
August 12th, 2008 at 4:59 pm
@Jim
I agree, and the intent of my above comment as not to trivialize Ruby on Rails. In fact, if it wasn’t for RoR, I don’t think that rapid development frameworks would have arrived so quickly into the mainstream developer community.
The sexy marketing hype behind RoR is a very powerful thing and in exactly the same way that Apple has the quality of “i” technology behind it, RoR has a quality framework behind the gloss. In my experience with RoR though, I did feel that I was slightly limited in my choices. I commenced working with Django at around the same time so it is possible that my attention was stolen by Django before I could invest an adequate amount of time to RoR.
Almost all of the successful frameworks available have a lot to thank RoR for and I by no means wanted to take a stab at it, I just wanted to put my opinion across as to why I think there are better frameworks — namely Django — available.
August 18th, 2008 at 6:22 am
sorry for off topic. but i think you should include “year” on your post date.
and i cant find a contact page. overall, nice site.
September 1st, 2008 at 9:39 am
When I started with MVC and using PHP frameworks I created my own first, it was good, fast but not to functional for RAD. After that I developed apps in CakePHP and thought that it is really great, on the line to mark it best, but over the time, as applications I needed to develop were moving from simple to complex and from “who cares” to “care about details, architecture, scalability, maintainability …” I have found zillions of problems that I could not solve in such tight coupled framework. Then I moved to Zend Framework development. I still think that CakePHP is great framework but just for the purpose it is made, fast and dirty development, for something serious like product development and serious business software I’d prefer more decoupled frameworks, Zend is the best in the field currently and there are no arguments to fight with that.
See my blog post on CakePHP vs Zend topic
http://tinyurl.com/62vqja
October 21st, 2008 at 1:54 pm
I am seaching for some idea to write in my blog… somehow come to your blog. best of luck. Eugene