Amateur Protagonist Alister Sneddon

I once almost won a procrastinating contest, but I turned up.


When Should I Use A PHP Framework?

20th April 2014
By Alister Sneddon

An interesting question at my last job was raised in my direction. I was asked for some consultancy advice on how to improve the PHP development for future external projects. To give you some background the projects should be promised as waterfall development and quickly boil down to rushed agile fixes and changes. There were no development standards or any real development plan.

My first suggestion was to create a development standards document for the programmers. Once a standard to compare work is in place you start to create realistic goals and understand the quality of work VS timescale. My second suggestion was to implement SVN. If nothing else this would help enforce a structure.

While helping with the development documentation and implement/training users with SVN I was asked my opinion regarding classes in PHP. Now classes do work in PHP, however it is arguable in smaller projects if a library of global functions is more useful when you have no real grounds to build classes. I explained that due to the skill set of the programmers and the size of the projects he would suffer if he went "the whole nine yards."

After a few meetings as was asked what "the whole nine yards" really entailed for me. I said that the inclusion of a PHP framework in their development strategy would be going all the way.

This brings me in an interesting point, would they have seen any real improvement over the quality of their code by bringing in a PHP framework? The development work was almost always ad-hoc and normal not performed by trained programmers; more often than not it was anyone who would pick up a PHP book.

By using a framework they would go against the very reason I warned against using PHP classes, they would raise the entry level to who would successful modify the code. A major issue was changing the code and not understanding the impact it would have across the project. When you deal in single pages it is extremely easy to isolate problematic code.

With the implementation of the SVN going successfully they would be able to track where and when the issues happened but that does not means that would be able to work around the problems faced.

Looking back with hindsight it is clear to me that a PHP framework would not only hinder their development but would also create a greater divide on their resources. Higher entry level to understand the code might come with performance improvements but it will heavy restrict the employees you have which can contribute.

Ideally in a company where you do require PHP development you will hire a dedicated developer, they will be able to call the shots regarding PHP frameworks and the usage of classes. However as their only developer was leaving with no replacement it would be short sighted to believe the hobbyist programmers would successful contribute. This is not to down play the abilities you can learn when teaching yourself but a realistic opinion of a professional VS someone who is going above their job description to help.

While picking a PHP framework it is important to consider the learning curve and who will be working on the project. As much as I feel I have moved on for completely separate PHP pages written independently of each other, in that work environment the ah-hoc speed in which pages where modified and created called for such a practice.

While many attempts were made to unify the source code the project was simply too large, this was also hindered by the fact multiple users had attempted a "from scratch" approach resulting in more fragmented code.

The inclusion of a PHP framework would not only have called for a massive rewrite of an unknown amount of code but also the knowledge for someone to understand uncommented code from two years ago against legacy systems.

While PHP frameworks come with a truck load of advantages even when you read up on the different frameworks available they all support the same methodology.

PHP frameworks are fantastic however they are like tools on a work-man's belt. It is up to the work-man to understand when to use each tool. Your screwdriver might fix all of your current issues but it is not suited to deal with nails.

When consulting PHP development it is as important to understand the current skill sets and resources available as well as the desired outcome.

You filthy comment whore, you love it don't you?
Lets not be forgetting to +1 it now... I am tracking your IP...