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

Your name:

Reply:


Posted by Josh Whiting on 01/07/05 02:36

> 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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация