Re: RE: Your Opinion?! PHP4 coding style - Comment and Splitting source code
| From: | Mark Maggelet | Date: | Tue, 13 Feb 2001 22:03:35 +0000 |
| Subject: | Re: RE: Your Opinion?! PHP4 coding style - Comment and Splitting source code | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-39509@lists.php.net to get a copy of this message | ||
On Tue, 13 Feb 2001 16:48:10 -0500, Sam Leibowitz
(sleibowitz@btcwcu.org) wrote:
>My personal opinions:
>
>The effect of comments in code parsing speed is negligable. Never
>hesitate
>to put in a comment because you think it's going to slow down the
>procedure.
>If your speed requirements were that down to the wire, you should
>have gone
>with a compiled app anyway. Or a faster server. Or anything other
>than not
>putting in comments.
>
>That said, it's rare that I've written 2 lines of comments for every
>1 line
>of code, and I tend to be fairly rigorous (on good days, anyway)
>about
>commenting completely. You may want to consider putting some of
>those
>comments in seperate design documentation.
>
>Finally, I tend to break up my source code into several files,
>usually
>around the class definitions (I like object orientation). I usually
>wind up
>with one file for the database interface, a few files containing
>class
>definitions corresponding to the business logic, and an included
>fragment
>for each block of HTML which needs to interact heavily with the PHP
>(for
>example, pre-populated form fields). This is purely for
>ease-of-maintenance.
>
>Where you can, you should replace calls to include() with calls to
>require(), because require() is a bit faster. The catch is that you
>can't
>place require() calls in conditional blocks, so:
>
> if ($something) include($foo); // this is okay
> if ($something) require($bar); // this is not.
if ($something) { include($foo); } // this is okay
if ($something) include($foo); // this is not.