[]RSS

About Archives Artwork Comic Contact Philosophy Projects Tags

First impressions of CodeIgniter

[Comment]

January 26th, 2008 in Micro Blog

[CodeIgniter]I’ve been looking at CodeIgniter this week, a PHP MVC framework built by the ExpressionEngine1 folks at EllisLab. And while I usually find frameworks constraining, CodeIgniter avoids most of the common chafing with a simple, grounded approach.

The library runs under any recent version of PHP (4.x, 5.x), installs in a single directory in the web root of your project, and has minimal dependencies. It provides a simple MVC framework, a large set of helper classes, and a good amount of documentation. The site has two video tutorials, which are enough to get you started.

The pitch

You want a framework that does not require you to use the command line.

You can safely ignore the marketing fluff. The ‘no-command-line’ claim turned me off at first, as there’s nothing wrong with a framework that relies on a command line (and avoiding it misses out on some powerful tools). After working with the kit for a few weeks, it’s obvious that they’re talking about how it’s laid out in a simple, obvious way, and how it doesn’t require running helper scripts for scaffolding and initial setup. It’s not anti-command line at all, rather it’s just not as intensive as Rails (for example).2

The good

CodeIgniter does MVC using a set of simple base classes, routing pages requests in an obvious way through controller class members, who in turn expose views. The kit also provides a modest library of utility classes that fit the MVC abstraction, a simple ActiveRecord DB class, and a set of helper modules that provide common web site functions. I found the approach immediately obvious, and it worked well in all of my test code.

An example:

class Bugs extends Controller {
    function index() {}
    function comments() {}
}

The comments() member is called on the /bugs/comments/ URI, which then can set up queries and calls to display the appropriate view.

The library code is clean and clearly documented. I’m impressed by the layout of the kit, which makes it easy to work with from nearly any tool set.3 The ActiveRecord implementation hasn’t gotten in my way yet, but I haven’t built anything complex enough to properly test it. Performance is better than the larger PHP frameworks,4 as you can easily tailor what is loaded for a given application.

The bad

I’m disappointed that there is no access to tagged Subversion releases of the framework, as it’s a simple way to keep in sync. There also doesn’t seem to be much consideration for AJAX, though nothing about the design prevents it. And, I’m still not sold on abstracting the already-great abstraction of SQL, though many people prefer it.

Here’s an example of an ActiveRecord query:

$this->db->select('title')->from('mytable')->where('id', $id)->limit(10, 20);
$query = $this->db->get();

Luckily CodeIgniter doesn’t require the use of ActiveRecord, though I was surprised to find that the abstraction worked well for the simple problems. The wrapped approach may get in the way with the harder problems, though, and I’m curious to see if mixing ActiveRecord and plain-old SQL is workable.

I couldn’t find many larger sites or projects using the framework, but I have seen many good uses of their ExpressionEngine. The lack of users may harm the kit long term, and it certainly hampers the amount of anecdotal documentation available online. But popularity isn’t the only measure in a tool.

A “good enough” framework

I like CodeIgniter enough to keep using it. It’s clean and simple, which is a feat in itself. I am wary of its lack of popularity, but it’s clear that the company behind it knows what they’re doing. And while it’s not as hip as Rails, it’s clearly capable and mature enough for production.

  1. ExpressionEngine a newer CMS/weblog platform
  2. And we all know that fluff should never be taken internally
  3. I worked mostly in Vim with Nautilus, and Gnome-Terminal
  4. Comparing it to a similar Rails application I wrote in the fall

A first Django tutorial

[Comment]

November 13th, 2007 in Links

One of the best developers I know pointed me to a Django tutorial. Django is a Python-based Rails equivalent, that’s even less imposing than Rails. It’s a good corollary framework to Rails,1 as the approach is different enough to make you think a bit.

  1. Especially useful if you’re still trying to find a good framework, or thinking about design approaches

An alternative to Rails: Merb

[Comment]

November 7th, 2007 in Links

Merb is yet another framework, a new alternative to Rails.

Interesting Microsoft technology squirreled away in Robotics Studio

[Comment]

April 12th, 2007 in Links

The Most Revolutionary Microsoft Technology You’ve Never Heard Of talks about a generalized event-driven framework that puts the CLR’s and Vista’s eventing systems to shame. So where is it? Microsoft has it hidden in a closet, as a supporting library of their Robotics Studio.

The end of RDF for Mozilla?

[Comment]

October 21st, 2006 in Links

RDF, Mozilla, and Complexity, a discussion about the possible removal of RDF from the suite. The problem is that the replacement looks worse, though not all of the commenters agree. Maybe they should drop the framework altogether, and just build a damned good browser.

Rant (and rebuttal) on Ruby/Rails

[Comment]

May 29th, 2006 in Links

A rant against Ruby on Rails (which I’ve posted before), and a good rebuttal. Frameworks are dodgy at best, but they don’t always have to suck.

Defacto javascript library roundup

[Comment]

March 18th, 2006 in Links

These are my picks for the best base Javascript libraries:

Uber list of GUI frameworks

[Comment]

March 9th, 2006 in Links

A very large list of GUI tools and frameworks for all sorts of platforms.

Commercial 2d game development tools

[Comment]

February 3rd, 2006 in Links

A few popular commercial 2d gaming kits:

  • PTK (library-based, Linux/Mac/Windows/PPC)
  • Torque2d (full framework w/scripting, 2d via GL, Linux/Mac/Windows, scene-graph based). A T2D developers blog. Some examples
  • Popcap (library-based, Windows, Palm/PPC, 2d via GL or without)

Frameworks and Sucking

[Comment]

February 1st, 2006 in Links

Why I Hate Frameworks, a story that compares frameworks to mythical wood working tools.

Next page [>>]