> -----Original Message----- > From: Jay Blanchard [mailto:[EMAIL PROTECTED] > Sent: 05 June 2003 13:36 > > [snip] > > If I did this, would it make a huge amount of difference? > > I'm almost certain it WOULD make a difference, but apart from the > execution time, I can't think of anything worse than scrolling through > 2000 lines of code looking for the section I'm after. > > Or, even if *I* could find my way around, what about other developers > who have to decipher it later??? > [/snip] > > Even if the functions are in an include and I called that > include at the > top of the page wouldn't that just make the overall code the same > length? i.e. > > <?pseudo-code > > include("functions.php"); > > switch($action) > case "do this": > ..... > function(s) called > break; > > case "do that": > ..... > other function(s) called > break; > > case "do the other": > ..... > no function(s) called > break; > > ?> > > Now, it does make the code neater and easier to document no doubt, but > doesn't the script namespace above become the same length as > itself plus > the included file(s)?
Yes -- but consider this: include("common_functions.php"); switch($action) case "do this": include("do_this_funcs.php"); ..... function(s) called break; case "do that": include("do_that_funcs.php"); ..... other function(s) called break; case "do the other": ..... no function(s) called break; In this case, at most one of do_this_funcs.php and do_that_funcs.php is read and compiled -- and in case "do_the_other", neither of them is. That surely has to be some sort of saving, even if the multiple file accesses offset it somewhat. (I suppose I should benchmark this to find out at what sort of filesizes one outweighs the other, but I can't be bothered! ;) Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php