Re: Looking for an informed opinion

From: Date: Tue, 28 Nov 2000 02:31:41 +0000
Subject: Re: Looking for an informed opinion
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-27629@lists.php.net to get a copy of this message
This is a big personal opinion about programming, everyone is different, but I also like to keep my php code less than 1000 lines. The total code executed may be much more because of included files. I personally find it hard to keep track of more then 1000 lines at a time, if I split it up its alot easier. Just try and break up your code logically, don't have one include that does everything, I like to try an only put function's in include (not allways, but most often) include_once("$DOCUMENT_ROOT/include/session.inc"); include_once("$DOCUMENT_ROOT/include/database.inc"); include_once("$DOCUMENT_ROOT/include/time_date.inc"); I also for resuability try and only put code that would be aplicable to the rest of my site in these files. Chris Lee Mediawaveonline.com In article <3A23CE20.12429916@tapinternet.com>, michael@tapinternet.com wrote: > Larger scripts will become harder to maintain and debug - generous > commenting can help with this. If most or all of your functions are > related, keeping them in that file makes some sense, but again, > maintainability/readability can suffer. > > Perhaps breaking various pieces of functionality into different files, > but INCLUDE()ing them into just one file that gets executed is a good > balance. > > What do you mean by 'big'? 100 lines? 1000 lines? 10000 lines? We > don't have too many files that are >1000 lines in our code - but they > include other files as well, so at the end of the day one script may be > executing 2-3000 lines, but for readability and modularization purposes, > the functionality is broken down into multiple includes. > > This is a very subjective topic obviously, and I'm not convinced there's > a 'right' answer beyond what is best for your situation for the long > term. > > Hope that helps some. > > Cybercandy wrote: > >> Hi All, >> >> I'm writing a php script to receive emails save them into a mysql db >> and then another script to list and view them. My question is: At the >> moment I'm keeping all the viewing functionality within one script >> which generates the a number of different pages. Are there any major >> disadavantages to producing one big script rather than lots of smaller >> scripts for this page generation functionality? >> >> Allan Goacher Cybercandy Ltd >> > > -- > ========================== > Michael Kimsal http://www.phphelpdesk.com/search/ PHP Training > courses > http://www.tapinternet.com/php > > >

« previous php.general (#27629) next »