[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
    on Wednesday, August 06, 2003 9:34 AM said:

> I'm rewriting a lot of code and have decided to use classes... I'm
> wondering if this would be considered bad design or not...
[snip]

/Sounds/ like a good idea. Are you really going to end up with an array
of errors? Wouldn't you normally stop operation on the first error? Or
at the very least report back to the user on the first error*?

Maybe you could do something like this...

function doYourThing($this)
{
        if(!empty($this))
        {
                if($this == $that)
                {
                        // do this stuff
                }
                else
                {
                        // do this instead
                }
        }
        else
        {
                return error(400);
        }
}

error($err)
{
        switch ($err)
        {
                case 100:
                        $error = "you suck!";
                        break;
                case 200:
                        $error = "jo mama!";
                        break;
                ...
                case 400:
                        $error = "var empty";
                        break;
        }

        return $error;
}


Pretty close to what you were going to do, just slightly different.


hth,
chris.

* By error I mean something catastrophic like someone messing with the
values in the querystring or a variable containing data you were not
expecting. I don't mean someone forgot to fill in their last name on
your registration form.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to