Welcome Guest, Not a member yet? Register   Sign In
First Impressions
#1

[eluser]wr5aw[/eluser]
I've looked at a number of frameworks in the past couple of weeks. The goal was to find one that could handle most of my requirements without a lot of bloat. I looked at several but most were too tightly coupled for my taste. So most of those became fairly bloated by the time you loaded all the dependencies. CI looks to be the lightest I've found so far. Just the right amount of basic function with very little dependency overall.

So, I sledgehammered a static site I manage into a CI templated site. Nothing exotic and no CRUD required. Probably overkill but I wanted to see how CI performed. After one of those rare all-nighters, I wound up with a pretty slick app that handled the old stuff pretty well. And it seems to run lightening fast.

What really amazed me after testing on a live server is how easy the thing is to maintain. I literally just change a few config vars and there is absolutely no difference between running on my development server and the live one. I am very satisfied with the results and will continue to explore CI further.

I just started examining the core line-by-line and am starting to build a set of notes on some potential bugs in the core code. I'll soon be submitting some reports to the tracker along with my suggestions. I really haven't gotten too far in the process but I'll list just a couple here for starters.

First, I want to discuss directory separators. I'm sure it's been discussed some but given my current state of search laziness I'll go ahead and comment. While it's a rare event when a directory separator conflict occurs it's not totally impossible. I once spent hours debugging a method only to discover there was a problem with the directory separator. Now, I develope my stuff on an old Win machine (I know, flame away). And of course we know the system path for a Win machine uses backslashes. Most of the time PHP doesn't care if you use a forward slash on a Win machine. But on the rare occasion it does, it can cause major problems especially if no error is thrown. I've seen that happen live and in living color (red). It really should be addressed in the event someone is running on a Win machine.

What I normally do is setup a short constant named DS that contains a proper directory separator. Then I either create my system paths using DS or somewhere along the line I replace forward slashes with DS. I realize there are times when we use a combination of system paths to create a URI path. That makes it quite convenient when we use a forward slash as the standard directory path. But there are still those rare occasions when a forward slash bites us on a Win machine. Here's an example of the code I use to handle directory separators:
Code:
if ( !defined('DS') )
{
    if ( defined('DIRECTORY_SEPARATOR') )
    {
        define('DS', DIRECTORY_SEPARATOR);
    }
    else
    {
        if ( FALSE !== strpos('\\'. dirname(__FILE__)) )
        {
            define('DS', '\\');
        }
        else
        {
            define('DS', '/');
        }
    }
}
Then, for example, in line 91 of index.php:
Code:
define('BASEPATH', $system_folder.DS);
Next thing on the list is improper validation of empties using isset(). Here's an example from Hooks.php:
Code:
if ( ! isset($data['filepath']) OR ! isset($data['filename']))
{
    return FALSE;
}
In the even the 'filename' key in $data IS set but is empty or space(s), we throw a fatal error down the line when we try to include an improper filename. I would probably do something like this:
Code:
if ( isset($data['filename'])
{
    if ( trim($data['filename'] == '' )
    }
        return FALSE;
    }
}
else
{
    return FALSE;
}
Just a couple of observations I have after a relatively short introduction to CI. But, like I said, I am very pleased with what I've seen so far.




Theme © iAndrew 2016 - Forum software by © MyBB