Framework Comparison
Comparison of three rapid development frameworks for use in future projects.
RAIV (Rack and Inventory Viewer)
Chisimba
Django
CakePHP
http://cakephp.org
CakePHP is a rapid development framework for PHP that provides an extensible architecture for developing.
RAIV - currently not in use or development
Chisimba - active community but only used by AVOIR.
Django - very active community and some big deployments (i.e. washingtonpost.com), at least 100 people in the irc channel
CakePHP - very active community and some big deployments (i.e. mozilla addons), lots of people in the irc channel
Documentation
All these projects are well documented.
Programming Language
Both languages are easy to learn but python is much easier to use. Python syntax is simpler, especially for certain things such as lists and iterations. Simpler syntax means it is easier to code and easier to read. Even when another framework has the same feature as Django it will have a distinct advantage due to language.
examples of simplicity:
| | PHP | Python | Description |
| variable | $var | var | all variables require the extra $ to identify them in PHP. |
| member references | $var→member1 | var.member | PHP uses 2 characters → to indicate a reference whereas python uses only 1. |
| array subsets | array_slice(array, offset[, length]); | var[start:end] | In python, all strings and arrays can return subsets using index notation |
Object Relational Mapping
All three systems use an Object Relational Mapping (ORM) to simplfy building apps. An ORM requires you to define a model and then abstracts some part of interaction with the database. The most common abstraction is that an ORM removes the need for a programmer to write SQL.
RAIV
Uses PearDB for an ORM
Table creation/deletion SQL scripts must be manually written.
Functions for db interaction such as insert/update/delete must be manually written because objects are not automatically converted to PearDB.
Fields can be added to objects at runtime so users can define what data they need to track.
Chisimba
Custom ORM
Tables are generated from a model object.
Functions for db interaction such as insert/update/delete must be manually written because objects are not automatically converted to structures the ORM expects
Does not appear to support relations in models, relations must be enforced by software.
Django
Custom ORM
Adhers to the DRY Principal (don't repeat yourself). Models are defined only once.
Tables are generated from a model object.
Function calls for db interaction such as insert/update/delete are generated automatically and are the same for every object.
Objects are DB aware. e.g. Object can save themselves.
Standard relations 1:1, 1:M, M:M, M:i:M are supported by models.
Models support inheritance
CakePHP
Custom ORM
Model fields are derived from SQL tables using introspection
Function calls for db interaction such as insert/update/delete are generated automatically and are the same for every object.
Objects are DB aware. e.g. Object can save themselves.
Standard relations 1:1, 1:M, M:M, M:i:M are supported by models, but they are defined in the model classes rather than derived from DB Tables. This splits the model definition into two places.
Models do not support inheritance by default. I found two tutorials
1 2 that add this functionality but they do not completely implement the concept.
Modules/Plugins
RAIV
RAIV was designed to be a modular system.
The RAIV module system includes the concept of hooks so that modules can talk to each other in addition to standard hooks from the system.
By default it contains modules for tracking server room information.
Chisimba
Chisimba was designed to be a modular system.
Collection of over 100 modules.
Includes a package manager for installing new modules
Django
Django has “apps” which are analogous to modules.
no runtime configuration for apps
Only a small set of apps but important ones are there: Auth, Admin, Databrowse
CakePHP
CakePHP has plugins
no runtime configuration for plugins
Only a small set of official apps but important ones are there: Auth, Admin, etc. More can be found from the community
RAIV
Uses a set of standard event hooks such as “list”,”create”, and “update”.
Handlers for hooks must be created that create and or process forms.
Functions must be custom written to define the elements on the form.
HTML is then generated using smarty templates that process the form objects.
Chisimba
Django
Generic handlers for listing and displaying objects.
Custom handlers also available for more complex forms.
includes convenience functions for simplifying common actions
CRUD front end is built in automatically to the admin application. Filtering, sorting and other layout options are available with only a few more lines of code.
includes template inheritance and includes for building modular components
regex url mapping for handlers to create sane URLs
CakePHP
has a templating system, including ways to reuse templates within other code
includes helpers for a lot of things such as ajax. Many community provided code snippets.
regex url mapping for handlers to create sane URLs
Database support
RAIV - mysql
Chisimba - mysql
Django - mysql, postgres, SQLite, oracle, postgresql_psycopg2
CakePHP - mysql, postgres, SQLite, pear db drivers, ado db drivers
Localization
RAIV - no localization
Chisimba - included
Django - included
CakePHP - included
Upgrades
RAIV - RAIV does not appear to have a mechanism for upgrading from one version to the next
Chisimba - Chisimba has a system for including patches from one version to the next. this allows tables to be updated without destroying data
Django - tables can be regenerated from the django model at any time.
CakePHP - Scripts for updating Database tables must be manually written.
I lack the infrastructure to properly test the performance of the frameworks. All three frameworks can be coupled with apache via mod_php or mod_python which both perform very well.
Here is an in depth performance testing. Unfortunately it only has django vs other frameworks that were not compared on this page.
http://www.alrond.com/en/2007/jan/25/performance-test-of-6-leading-frameworks/
Overall conclusion
I would recommend the frameworks in this order:
1) Django
Easiest & fastest to develop with because of DRY Principal
Potential for cleanest code because so much is automated.
Very active community for support and continued development of the framework
The major drawback of Django is the immaturity of its module system and limited set of modules. Some additions like a hooks app, and a configuration app would rectify much of this problem. However, a full fledged configuration app will be somewhat complex to implement well.
Note: there is a configuration app in the djblets package but it does not create a central place for configuration.
2) CakePHP
CakePHP is a close second behind Django. It also has a large community that is very helpful and the framework is robust, easy and fast to use. Where it doesn't do as well is the ORM.
Models are defined partly in SQL and partly in PHP classes.
No inheritance by default, only limited support can be added. This is one of the core principals of Object Oriented design.
Primary definition of models is done via SQL Tables. This can cause a variety of problems:
3) Chisimba
Chisimba's main strength is the sheer number of plugins already available. This would be a good choice if you are looking to build a content site or anything that Chisimba can already do.
The reasons why Chisimba isn't as good as Django and CakePHP:
It also has a good community behind it, but not nearly as big as Django and CakePHP. A healthy community and adoption is key to long term success of a project. Chisimba has a lot of potential but it isn't there just yet.
It lacks relations among model objects (or at least it wasn't in the documentation). Relations can be created but only in the handlers that read and write objects.
4) RAIV
RAIV has a well designed module system but lacks a community behind it. Choosing this framework would mean we not only have to support apps we create but support the underlying framework as well. While its possible we could build a community as we use the framework, there is no guarantee that it will ever take off.
Other Frameworks
Ruby on Rails
We do not have many people here who know ruby so I didn't consider this a very good option. There are also performance concerns with rails.