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

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

 



> If I have a large app what is the difference, other than having a very
> large file, of doing this
> 
> 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;
> }
> 
> 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 being the case the code would essentially be the same length. Given
> that, would there be an efficieny issue?
> 
> This would (the second way) also make the project easier to work on by
> multiple programmers at the same time, similar to modular work being
> done by programmers on C++ projects.

Correction: include() statements are executed at *run time*, which means
that if the case is not executed, the include will not be executed and
the file is not even read!  The include() method is not only more
efficient but also easier to maintain as you suggest.

Otherwise, I'm curious as to why you're using a large switch, not that 
it's bad inherently IMHO, but there may be a better overall approach. 

/jw

-- 
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