Sunday, 1 June 2014

Zend Framework VS CodeIgniter VS CakePHP VS Symfony Part 1

The annoying thing about programming is that the "right" way is not always obvious until you have done a lot of work on a project, sometimes design flaws only become obvious much later in production environments, when the real world starts to attack your lovely code.

The best way to avoid the wrong way is to try to arm yourself with as much knowledge about what is available as possible to reduce the chances of incorrect decisions. As such I have been looking into various PHP frameworks to try to establish which will be optimal for a project I am working on.

All four frameworks are designed to try and help you produce software as quickly and efficiently as possible. The goal is to assist you making the correct design decisions from the outset so that code is more reusable and easy to understand.

All the frameworks essentially rely on the Model View Controller (MVC) design pattern and the main learning curve to each is understanding how the Model, View and Controllers are created and plug into the frameworks.

In addition to providing the general "glue" for the MVC mechanism they also provide libraries primarily of helper functions, but in the case of Zend framework there are quite substantial areas of functionality such as Lucene search.

Prior to starting this investigation I had previously used both Zend Framework and CakePHP on some old projects so they perhaps have a bit of an unfair advantage as I am likely to find them easier to use and am more aware of the useful functionality which can take a while to uncover.

In a Nutshell

Zend Framework has the largest library of available functions, but at the same time the MVC layer is the least well defined, while it is common practice to use Doctrine as your model layer it is not explicitly required, in fact the library can easily be plugged into an exist project without using all of the general framework functionality.

CodeIgniter is certainly the lightest of the frameworks, is even has the flexibility available to only have a 2 layer pattern and not use MVC, although this would obviously not be advised. Its light weight nature leads to more code being written, and a lack of struts to quickly start up an application, but the opposite side of this is that the imposed overhead is minimal.

CakePHP appears to have the strongest struts in place, you can have a proto-type application up and running very quickly, but it does appear to have the least flexible structure and the helper libraries appear to be well defined, but do not provide the same range as Zend does.

Symfony seems to sit halfway between CakePHP and CodeIgniter in terms of available structure and functions.

What's in store for part two

Part two is going to be the most interesting part, sadly it will take a couple of weeks to put together. I aim to evaluate the raw performance of each framework with a basic application. Additionally I am going to try and establish which is the fastest to work in and which is the most code efficient.

1 comment:

PaweĊ‚ Szczepanek said...

A good start. If you are familiar with each framework very well, consider to using database query (maybe with some references) and non-trivial template structures - of course very similar in each FW.
IMO think about a small app and not only "Hello World" - then tests will be more life common ...