Re: Embedded example code

From: Date: Thu, 28 Mar 2002 20:48:45 +0000
Subject: Re: Embedded example code
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-5135@lists.php.net to get a copy of this message
Examples belong in documentation, or at least comments, not directly in the code itself. I don't see any advantages in embedding them this way, only disadvantages (bloat, one method is often not enough, risk of dead/unmaintained code that maybe ends up in CERT advisories...). -1 - Stig On Thu, 2002-03-28 at 20:40, Richard Heyes wrote: > Saw Jon Parise post on the engine2 list regarding example/test code embedded > in class files. Thought this could be useful here. > > For example: > > class My_Class { > > ... > > function example(){ > // ...example code > } > } > > if(basename($HTTP_SERVER_VARS['PHP_SELF']) === basename(__FILE__)){ > My_Class::example(); > } > > Any thoughts regarding it? Possible problems I see are: > > o Unnecessary code loaded > o Issues when pear directory is inside document root > > -- > Richard Heyes > "If you have any trouble sounding condescending, > find a Unix user to show you how it's done." - Scott Adams > > > -- > PEAR Development Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.pear.dev (#5135) next »