Re: On large application organization [long and possibly boring]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jay Blanchard wrote:
> switch($action){
> 	/* several dozen cases to follow */
> 	case "foo":
> 		writing out all of the code
> 	break;
> }
>
> and this
>
> switch($action){
> 	/* several dozen cases to follow */
> 	case "foo":
> 		include that will handle processing this case
> 	break;
> }

Performance-wise, there is probably a minor 'loss' to the second one.

But the maintenance benefits of the secodn one FAR OUTWEIGHT the
performance question.

The only conceivable exception to that is if you *HAD* to put all of that
long code inside some loop that runs a zillion times...  You've got bigger
problems to solve if you're doing that anyway.

> Correct me if I am wrong, but includes (and/or requires) will get all of
> the code in all of the cases regardless if the case is being processed.

That got covered in depth already.

> etc

One thing I will say:

When I first started with PHP, I did this, because I was coming from a
desktop application background.

But it ends up being not all that maintainable, and you end up having to
open up and track too many files with too many interactions when you go
down this route.

I abandoned this style and have never regretted it.

YMMV

-- 
Like Music?
http://l-i-e.com/artists.htm

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux