Back when CakePHP’s v1.2 was still in its beta stage, I started learning the PHP language using the MVC (model-view-controller) framework, and I grew to love the language. I became more fluent with the language as I grew more biased towards cake. I would often google MVC comparisons like “CakePHP vs codeigniter“, or “CakePHP vs symfony“, etc, but in my heart, I knew CakePHP was the one for me.
In my previous job, I was thrown into a project where we had to decide which 3rd party MVC framework to use, and so began my research. I was assigned to look into symfony, and to my surprise, I was impressed with what it offered. My first impression of the framework was great, and it got me thinking… maybe CakePHP isn’t always the way to go. Unfortunately, my research ended shortly due to my moving to a new job and company, but I was able to continue my research when I was forced to use codeigniter for the project I was assigned there.
Custom Frameworks
Creating your own custom framework is great. It’s awesome. It’s something that you can call it your own. I have attempted to create my own MVC framework, twice, but always ditched the project halfway due to my laziness (I’ve got too many hobbies and my interests change by the day).
But is it really worth your time? If you are working on a small personal project, then I’d say great, otherwise, you should look into using a 3rd party framework. Custom frameworks may seem like a good idea at first: it’s custom, you know the framework inside out, etc the list goes on, but as you make the finishing touches to the framework and move on to making the applications on it, you start to find out that not only do you have to worry about bugs in the app, but in the framework as well. Suddenly you have twice as many bugs, and twice as much work. If you were to use a 3rd party framework, you wouldn’t have to worry about that since another party does all the work for you.
And you get to belong to a big community! (assuming you pick one of the big name frameworks)
“OK so… which framework?”
This is a question that many programmers ask when they start a new project. Don’t you just love the new project smell?
There are millions of sites available discussing which framework is better versus which, so I won’t do any comparisons between them. I will, however, get into what you should think about when choosing a framework.
Learning Curve
How tight is your schedule to meet your deadline? Too tight? If you are one of those guys that shoot for “as long as it works” then you might as well choose the framework you are most familiar with and stop wasting more time.
This subject is largely based on not only your experiences, but on documentation and the community. Do not get fooled by the “blog tutorials” provided in their websites, since many times it may mislead you into thinking the framework is easy to use and developing on it will be quick, but in reality the actual app you want to make is a thousand times more complicated than a simple blog app. Take the time to check out their API documentation as well as their forums if they have.
Naming Conventions and Coding Standards
This is another thing most programmers neglect to consider when selecting a framework. I find that following the framework’s conventions and standards, although not required, makes life easier when developing on it. While this could be considered a preference more than anything, adopting the framework’s conventions and standards will often save you time. If you can find an existing framework that suits your way of coding, and you are strict about the way you code, then the framework may be the one for you.
Maintenance
Sadly, many programmers write unmaintainable code. Unmaintainable code is code that is unfriendly to changes. Functionality in programming should always be centralized and easily interpreted.
If you plan to whip something quick and never bother with it again, then you should not pay attention to this subject, but if you plan to maintain your project over time, then always think of ways to make maintaining code easy and painless. Most frameworks have ways to organize user defined functions, whether it’s helpers, components, libraries, etc, you name it. If you’re always confused as to where your code should go, then you may want think about choosing a different framework.
Performance
If your schedule is flexible, and you have the freedom to really optimize your app, then you should ditch all the other questions and stick to the two subjects that matter most in the end: maintenance and performance. I mean, sure, while developing you may run into some issues, and some frameworks may be easier to work with, but in the end, all you should really care about is how the application performs and how painless maintaining the code can be.
There are many performance comparisons out there, and they should all be analyzed before choosing the right framework.
In this post, I have focused mostly on MVC frameworks, but this pertains a lot to other frameworks as well.