Re: Include file must be valid

From: Date: Fri, 28 Jul 2000 20:17:52 +0000
Subject: Re: Include file must be valid
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-8843@lists.php.net to get a copy of this message
It seems like breaking up code into incomplete include files is really bad form. It would make code next to impossible to debug, let alone read. It might make total sense the day you code it, but what about when you come back 6 months later, to update code or add new functionality, and all your code is split up into many includes that depend on the code of other includes to work correctly? Or if someone else takes over your project, will it be immediately obvious what each include does, and what dependencies they have on each other? I like the tighter include scheme in 4, since it forces you to make cleaner code. I think in general includes should be self contained, and not depend on you having included file A in the base file for file B to work. That way, if you come back later to add more functionality, or clean up code, you can feel safe editing an include as long as you keep the method's contract. Cheers, Luis On Fri, 28 Jul 2000 luis@note.amherst.edu wrote: > It seems like breaking up code into incomplete include files is > really bad form. It would make code next to impossible to debug, let > alone read. It might make total sense the day you code it, but what about > when you come back 6 months later, to update code or add new > functionality, and all your code is split up into many includes that > depend on the code of other includes to work correctly? > Or if someone else takes over your project, will it be immediately obvious > what each include does, and what dependencies they have on each other? > > I like the tighter include scheme in 4, since it forces you to make > cleaner code. I think in general includes should be self contained, > and not depend on you having included file A in the base file for file B > to work. That way, if you come back later to add more functionality, or > clean up code, you can feel safe editing an include as long as > you keep the method's contract. > > Cheers, > Luis > > On Fri, 28 Jul 2000, Jason Stechschulte wrote: > > > I fail to see the problem. If someone doesn't > > understand how to create a while structure, > > perhaps they should learn it rather than creating > > wacky code. > > > > Jason Stechschulte > > jpstech@nc.edu > > > > -----Original Message----- > > From: Simon Biela [mailto:s.biela@netdienste.de] > > Sent: Friday, July 28, 2000 1:36 PM > > To: Zeev Suraski; php-general@lists.php.net > > Subject: Re: [PHP] Include file must be valid > > > > > > But this issure is not really helpful for > > developers. The documentation > > says, that include just pulls the content of the > > file into the other file. I > > don't want that file to be evaluated for itself. > > > > The example I gave, is a help for people who don't > > understand how to create > > a while structure but want to use it. > > > > Instead of writing > > while ($output[something][$i]) { > > > > or even something more complex, they just have to > > write > > > > include(whilestart) > > > > What other possibility do I have to solve this > > problem? > > > > Thanks for answer > > Simon > > > > > > >That's true. It's an issue which should be > > documented - it's not a bug. > > > > > >Zeev > > > > On Fri, 28 Jul 2000, Simon Biela wrote: > > > > > Hi there! > > > > > > I just migrated from PHP3 to 4. In 3 it was > > possible to include a file > > which > > > wasn't really valid, for example with an opened > > while statement, which was > > > then closed in another include file. > > > > > > It seems, that in PHP4 the code in an include > > file must be completely > > valid. > > > > > > here's an example > > > > > > file1.php > > > $i = 0; while($something[$i]) { > > > > > > file2.php > > > $i++; } > > > > > > file3.php > > > include (file1.php); > > > echo $i > > > include (file2.php); > > > > > > > > > --- > > > netdienste GbR > > > internet & multimedia > > > Geisselstrasse 19 > > > 50823 Koeln > > > > > > tel: +49 221 - 932 958 2 > > > fax: +49 221 - 932 958 5 > > > > > > s.biela@netdienste.de > > > http://www.netdienste.de > > > > > > red:pepper - das redaktionssystem > > > www.redpepper.netdienste.de > > > > > > > > > > > > > > > > > > > > > > -- > > Zeev Suraski <zeev@zend.com> > > http://www.zend.com/ > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: > > php-general-unsubscribe@lists.php.net > > For additional commands, e-mail: > > php-general-help@lists.php.net > > To contact the list administrators, e-mail: > > php-list-admin@lists.php.net > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > > For additional commands, e-mail: php-general-help@lists.php.net > > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > > > > >

« previous php.general (#8843) next »