After years of using WebForms I decided to venture out and see what other frameworks exist. I didn’t really have any expectations or requirements. I was simply curious what others were using and interested in what’s different (perhaps better) about them. In my search I stumbled across a light-weight web framework known as CodeIgniter.
CodeIgniter bills itself as a simple yet powerful Web Application Framework with a small-footprint that allows you to build incredible PHP programs. You heard me right, I said PHP. Remember that scripting language that you used to use in high school? Turns out that while I left for .NET it’s been busy becoming a mature, professional language; as CodeIgniter proves.
The CI framework has adopted the MVC design pattern. I have not had a lot of direct experience with this architecture. I first remember hearing about it in a course discussing Smalltalk and how MVC was the best thing in computers since silicon. I remember thinking at the time how painful it must be to follow this architecture. I was right based on the tools I was using at the time: Visual Basic 3. I figured it would have been a nightmare to even attempt and so I moved on and didn’t give it much thought until I started looking at CI.
The first thing I realized was how well suited MVC is for a web application. CodeIgniter did a remarkable job in their implementation. Everything is neatly tucked into specific, well-defined folders. To use CI effectively you will need to accept the existing layout of the application and adopt a “just go with it” attitude. This sounded scary at first but after using it for a while I realized it was well-thought out and generally felt “right”.
One part of the framework that I found particularly interesting is the URLs produced. CI uses a segmented approach to parsing the URL into instructions the framework understands. For example consider this URL:
http://michaelminton.com/index.php/posts/delete/46
CI would interpet this to mean call the delete method in the posts class with the parameter 46. This is a nice human readable URL that looks much better than the normal dynamic URLs that are littered with ? and &.
CI also has built-in helpers that abstract away many of the common features. The most common one I used is for creating links to other parts of the application. It’s best described by example:
echo anchor('posts/delete/46', 'Delete Post', 'title="Destroy"');
This would result in the following:
<a href="http://michaelminton.com/index.php/posts/delete/46" title="Destroy">Delete Post</a>
I have not really had a chance to write a full application using CI but I have to admit I’m very impressed with what I have seen so far. ASP.NET doesn’t even come close. CI really has lived up to its hype. It really is powerful, albeit clunky at times, and it makes web development a lot less painful…simple even.
You can find out more about this awesome framework here: http://codeigniter.com/.
Design by Simon Fletcher.
© Copyright 2012