I'm considering learning a PHP framework for rapid development. I've a solid background in PHP and Jquery including AJAX. I'm felling that there should be some major flexibility that I lose if I use frameworks, just like using CMS's. Is it true? Or can I build virtually anything AJAX driven using frameworks? Like including notifications...(just like facebook)
views:
58answers:
4You can build virtually anything with a decent framework by just extending it. You don't want to build a large project(like Facebook) using raw code... that would take a really long time, would be very buggy, and is just bad design.
Personally I think you could write your own framework.
- this is 'fun' to do (read; you'll learn a lot from it);
- the you spent on learning a framework built by someone else you now spent on creating your own, directly learning all the ins and outs
I mean, if you think of it, for basic operations. What do you really expect from a framework?
- Some access/security checking/processing;
- Have Models and Controllers for your database;
- Have a Base-class for handling your properties;
- Have some other classes that you might find handy (ObjectList, DB-Layer, Exception-reporting, BaseController etc);
- Some sort of renderer (or just use an index file to do such things).
Okay, if you write your own framework you could end up buggy. But don't you kinda take the same risk when starting to learn a new framework? Having all the posibillities of using it's functionallity in a poor or even wrong way due to it's complexity?
There are plenty of pre-made blog softwares out there, but in order to learn PHP, I used CodeIgniter to make my own blog. If you work on it, you can make anything, but also don't reinvent the wheel. If there is something already made, there is no shame in using it.
It really depends on what you are trying to accomplish. The problem with writing your own framework for a project like this is that you are the only one who knows where everything is. So you get the task of not only writing the framework, but documenting it, and then putting all of the functionality in on top of that. Not to mention trying to ramp up any new member of the development team.
Why A Framework
A framework already has many developers (and others) behind it. Why not leverage the framework? There is a large community of people behind most frameworks. And if you pick the right framework, you will also get plenty of excellent documentation. In addition, there are third party plugins, components, addons that the community develops as well. All of which will be easy to understand because they will (mostly) follow the standards of the framework.
In addition to the community and leveraging the man hours used to create an open source framework, it allows you to focus on the bits of your application that are most important: the functions the pertain specifically to the application. Why waste time writing all of the mundane parts: ie. database connections, apis, email senders, templating, etc. Use what is out there and go to market much faster.
My Suggestion
I use CakePHP. It is OOP and very structured. They may be a small learning curve as with every framework. But the implementation makes development very fast. There are some high profile sites that use it and it works great. (https://addons.mozilla.org/)