开发者

Why is so much documentation of cakephp in 2006, 2007? Should I bother learning CakePHP?

I am considering learning CakePHP, but I see that almost all scripts and documentation are from either 2006 and 2007 and the backwards compatibility with those scripts is fairly poor.

Also most comparison charts of cakephp vs zend vs codeigniter vs others are made in 2006, 2007 or at last 2008. I am not looking to pick either one of them, since cakephp still seems to have the same advantages/disadvantages compared to the others as 4 years ago.

But I would like to know if I would be wasting my time learning cakephp. It seems lovely at first glance, but I have created many websites and am still unfamiliar with the MVC model. I want to maximilize my efficiency and competence in writing websites in PHP.

I currently make use of simple includes for the layout and still mix HTML code with PHP code. It works better then you'd think at first glance, but I think it's time to improve my PHP coding, quality of p开发者_如何转开发rogramming and a higher efficiency in programming speed is always welcome.

  • Is learning CakePHP at this moment wasted time or a good plan in order to make a next site better, not just programming-wise, but also in quality/features/programming speed/scalability, than all my previous sites?


I can definitively say that CakePHP is still in use, and its featureset and documentation are growing stronger. I am using CakePHP (1.3) on several projects and it is relatively easy-to-use, once you're familiar with MVC.

There is a learning curve though, and if you (like me) came from a world of intermixed PHP/HTML then any MVC-oriented framework will require you to first unlearn the tightly-coupled logic and presentation before you can take full advantage of the MVC way.

Some tips that I picked up after over a year of working with Cake (and some should apply to other frameworks as well):

  • The "official" documentation sucks, but it's getting better. Thankfully there are a ton of people using Cake and blogging about how to do things -- don't be afraid of Google.
  • Put as much business logic as possible into the model (aka "Fat Model, Skinny Controller").
  • Make sure your database structure is as close to final as possible before you start coding the interface. It's not difficult to go back and change associations, add fields and add validation code -- but it's a bit tedious.

To your other points:

  • No, it's not a waste of time to learn MVC and Cake. Once you understand it, it truly does make application development faster and helps you write more stable and maintainable code.
  • Most people don't necessarily equate speed and scalability with PHP-based frameworks, though that's not to say that they aren't "fast enough" for most uses. A bit of targeted Googling should turn up some speed comparisons.
  • There are some very large sites on Cake, and some of them have even chronicled their scaling efforts.

TL;DR: Take the time to learn MVC, even if you decide against using a framework your code will improve because of it.


One of the keys to good web application design is separating your business logic from your presentation. Close behind it is abstracting your data sources so you can change the data model without having to rewrite all your code. CakePHP and many other MVC frameworks help you do that. Overall it makes for more manageable code.

I can't make a decision for you but I do use CakePHP in my own projects. The documentation is actually extremely good for CakePHP. It is one of its strongest points. I'm not sure where you are getting your 2006/2007 numbers.

http://api13.cakephp.org/classes has all the API / class documentation for 1.3 (which was released less than a year ago - with 1.3.10 being released just weeks ago)

Granted that the CakePHP "book" hasn't been updated for 1.3 yet but just about all of the tutorials and how-to's for 1.2 will work with 1.3. <= yes it has, sorry

The CakePHP "book" has tons of examples and a great tutorial.

Additionally, the Cake Bakery has many excellent user submitted tutorials.

The older benchmarks do paint a grim story, however, 1.3 is significantly faster and better performing than previous versions.

The important thing -- in my opinion -- is that you get away from "tag soup" and structure your applications so that they are manageable. What framework you choose is your call. It could be CakePHP, Zend, or even one that you write yourself.

Note: MVC can be difficult to grasp at first. You'll need to have a good understanding of object oriented programming. But learning is a good thing!


Have you tried asking the community online or in person? You could also check out the CakePHP community passively on GitHub and see if people are using the code the way you would like or for things you like.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜