You are here: Re: [PHP] On large application organization [long and possibly boring] « PHP « IT news, forums, messages
Re: [PHP] On large application organization [long and possibly boring]

Posted by Richard Lynch on 01/07/05 19:37

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

 

Navigation:

[Reply to this 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

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