johngirvin.com

John Girvin

This is the blog of John Girvin, a software engineer and web developer based in Belfast, Northern Ireland. He draws on over 14 years of hard won, real world experience of different projects, clients and working environments. Visit the rest of the site to find out more and get in touch.

John is currently working with the Art Technology Group (ATG), developing J2EE based, market leading e-commerce technology.

book review: codeigniter 1.7

December 4th, 2009 by John Girvin

I wrote recently about a new book from Packt Publishing covering the CodeIgniter PHP framework that I’ve used in a number of my personal projects. I’ve now had time to read through the book, and this is what I found.

CodeIgniter 1.7

CodeIgniter 1.7, written by Jose Argudo and David Upton, aims to help you “improve your PHP coding productivity with [...] the powerful and popular CodeIgniter framework” and is designed as a companion to the excellent user guide that ships with CodeIgniter itself. It is aimed at both newcomers and more experienced developers alike. Books on CodeIgniter are thin on the ground, so as a long time CodeIgniter user (and fan, I’ll admit) I jumped at the invitation to review this new book shortly after its publication.

I’ve been using CodeIgniter in many of my personal and freelance projects for a number of years. I chose CodeIgniter over other PHP Model-View-Controller (MVC) structured frameworks initially for its lightweight approach, where the framework provides a basic skeleton for the developer to build an application on and then gets out of the way. This simplicity means that learning to use CodeIgniter is relatively easy compared to, say, CakePHP or the Zend Framework, but is balanced against the extent of the functionality that the framework provides.

But if the framework is so easy to pick up and the supplied documentation is of a high standard, who needs a book? If you’ve never developed an MVC patterned web application before and are about to attempt one based on CodeIgniter, then you do.

The book starts with a comparison of CodeIgniter with CakePHP and Joomla!. I see what the authors were trying to achieve here, comparing the lightweight CodeIgniter with a more popular and feature heavy framework and again with a full content management system, but this chapter comes across as clumsy and a little confusing. I also would have liked to have seen other popular PHP frameworks such as Symfony or Zend included in the comparison, or at least mentioned in passing.

The meat of the book begins by covering the very basics of downloading CodeIgniter, walking through it’s directory structure and then getting a “Hello World” application up and running on your development environment. Further fundamental topics are then addressed such as accessing databases, creating controllers and views and using sessions, before upping the pace and moving on to more advanced material on caching, file handling, creating your own CodeIgniter extensions, internationalisation of applications and even using XML-RPC remoting. There’s also a useful chapter on moving your development site on a live server, something that always causes problems even if you’ve done it before. A summary of the framework and a list of external resources wrap up the contents list.

Each chapter is written in a relaxed, personal and conversational style that’s easy to follow, and there are plenty of well explained code examples. The style works well enough but I think an extra editing pass would have been of enormous benefit, to pick up on spelling mistakes and more than occasional awkward phrasing. This omission is unfortunate as it gives a bad impression of a book that’s actually quite good technically. Much effort is made to underline good, sensible development practices and highlight the benefits of building web applications using the MVC pattern. There’s nothing on  source control or testing of your web applications though, which I thought would have been obvious subjects to cover.

CodeIgniter 1.7 on it’s own won’t teach you how to develop web applications using CodeIgniter but, by working through the book and cross referencing with the CodeIgniter user guide for further and more detailed information on the classes and functions touched upon in the text, I think you could progress a long way very quickly. The user guide is good as a reference source, but I recall that when I was starting out I would have welcomed some material that gave a “bigger picture” view of the framework and acted as a tutorial and best practice guide. CodeIgniter 1.7, I think, gives this high level view that I was missing.

However, I’m not sure how much experienced CodeIgniter developers would gain from reading this book. Reading it, I found myself skipping through a lot of the text as obvious, for example. There is still good advice to be found in the later chapters if you persevere, and they are more densely packed than the introductory ones, but I’m not quite sure this material alone would be reason enough to convince me to buy the book.

Without hesitation I’d recommend CodeIgniter 1.7 to anyone with some existing PHP knowledge who is starting out building web applications with the CodeIgniter framework. If you’ve been around the CodeIgniter block a few times, have a think about it first.

CodeIgniter 1.7 is available now in printed and eBook format. A sample chapter is available (PDF), as well as the full table of contents. Find out more from the official Packt Publishing website.

Disclosure: I have no association with Packt Publishing other than they contacted me to ask if I would review this book. I was provided with both a paper and electronic copy of the book for review purposes with no obligation. No other payment or payment in kind was offered or requested.

John Girvin
Bookmark and Share

John Girvin is an experienced a software engineer and web developer based in Belfast, Northern Ireland. He draws on over 14 years of hard won, real world experience of different projects, clients and working environments.

John is currently working with the Art Technology Group (ATG), developing J2EE based, market leading e-commerce technology.

If you liked this article, why not subscribe to the RSS feed for more?

4 comments on “book review: codeigniter 1.7”

December 4 2009, 6:38 pm

Interesting dissection John. I would love to hear a breakdown of the differences between Cake, which I use in the day job, and CI, which I have *never* used….

December 14 2009, 10:43 am

I’ve only ever had a quick look at Cake, but from what I saw I think you could summarise the differences by saying Cake gives you more but CodeIgniter gives you more choice.

For example, CodeIgniter comes with classes for basic database access but doesn’t include a full ORM. However, you can easily use Propel, Doctrine or whatever suits. Cake comes with scripts to generate controllers, models and so on, but CodeIgniter has none of this so you have more flexibility in how you write and structure code. I’m sure there are other similar differences too, but as I’ve said I’m not that familiar with Cake.

Take a couple of hours and have a play with CodeIgniter, it really doesn’t take long to pick up. Cake, Symfony and the rest have their place but for the types of PHP web projects that I undertake I find CodeIgniter is a great solution.

December 14 2009, 10:50 am

I used CodeIgniter for TwitLonger. Given that I’m a bit of a control freak over my code, using a framework was quite a big step, so I appreciate that CI does the boring, heavy lifting stuff and lets you get on with the application specific things. As John says, Cake seems to want to be everything to everyone but CI gives you the flexibility to do what you want but with a strong platform to start out with.

December 14 2009, 12:36 pm

My first introduction to web MVC frameworks was with Rails, 3+ years ago. Coming from there Cake seemed quite familiar and I’ve since become quite a fan of “convention over configuration.” Anything that makes me not have to make a decision, be it how to name my controllers or where my models are located is a win in my book :)

share your thoughts?

design & content © 2008-2010 john girvin, all rights reserved.