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

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

 



Jay Blanchard wrote:
> [snip]
> Richard Lynch speaks:
> 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
> [/snip]
>
> In favor of what?

Depends on the site -- on its size/scale mostly.

Small/Medium sites:
The URL matches a file, and that file includes any common code, and
handles the specific actions of that URL.  Tracking errors and code logic
is simplified immensely.

For a larger site, I don't believe in a cookie-cutter approach, so don't
have a single "answer" for you.  All I know is, I haven't had a
monster-switch to deal with an "action" since then, and when I have to go
maintain code that *DOES* have a monster-switch, I know why.  It's a PITA
to figure out what's pulling what in where, and I end up with too many
windows open with code scatter across too many files.

I guess the only "rules" I can give are:
1. Given a bug report about URL X, and only X, I should know exactly which
file to open to find the most likely source of the bug -- the distinctive
parts that make X be different from all the other pages.

2. Given a bug report that seems to involve multiple URLs, I should know
just from the error report, where the problem is most likely to be.

Throwing everything in a monster-switch right away doubles the number of
potential files, at minimum, but even higher than that for weird syntax
errors or simple mistakes in the switch login, which never ends up being
as simple as a switch().  You end up having almost ALL the files being
included being suspect when things get weird.  Get rid of that switch, and
have a more reasonable rational systematic way to know what's included,
and more importantly, what code is *NOT* *POSSIBLY* included, and your
possible source of Bug #8766533 shrinks dramatically.

Got my fire-proof undies on now.

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