Sunday, April 05, 2009

PHP Frameworks: CodeIgniter

CodeIgniter is a php web development framework... In its own words:
CodeIgniter is a powerful PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to create full-featured web applications. If you're a developer who lives in the real world of shared hosting accounts and clients with deadlines, and if you're tired of ponderously large and thoroughly undocumented frameworks
Instead of a web development framework I'd rather call it a collections of libraries that help you in developing a web application... I should continue with "easier" but is not actually like that, beacause "easier" for me means in the first place faster... The MVC pattern that tries to cover is actually going with some best practices and that's it... First time I tried CodeIgniter was at the recommendation of a fellow that was using CodeIgniter and was very happy with it... I tried to build a backend application for quote management, but I gave up and used a framework inspired by CakePHP, but quite truncated with a very good ORM... That was an unhappy experience and left CodeIgniter, and started using more and more CakePHP... The main reason I didn't continue with CodeIgniter was that I had to write lots of code... for everything I need I had to write code... And that's not helpful.. And after a year or so, at our company I got a very nice customer that was quite good four our image and decent pay... We already had a name, couple of large (national and multi-national companies) in out portfolio The code of the website was in 2 controllers (8k and 12k code code, yes that's 8.000 and 12.000 lines of code) and 2 views (the container of html code)... Of course CodeIgniter was used... They had no idea what they were doing in there....
class Start extends Controller {

function funcNameHere($paramx=''){
#code here
$data['content_html'] = 'html code here..';
#sql queries and stuff here... no models used...
#loops here to build the content
$this->load->view('main_view', $data);
#other 1000 functions here
So it's not at all easy to deal with this... But, without some extra-functionalities needed the application was working... Anyway, instead of rewriting the entire app, we just moved to a proper approach only the modules that needed to be changed... Details in another story maybe... This was another proof that using a Web Development Framework does not actually means writing quality code... My conclusions about CodeIgniter so far:
  • is a collection of libraries for developing web applications
  • not a RAD framework
  • too much code needed to be written
  • good documentation
  • lacks AJAX library
  • low complexity and easy to learn
  • weak ORM
So, a beginner that wants to use a framework, can start with CodeIgniter or if you need more control over your application also you can use CodeIgniter... I will be involved in projects that are built with CodeIgniter only if it's a requirement or it's easier than using something else. I prefer CakePHP (web applications development) and Zend Framework (as a toolkit)...

No comments: