Re: Coding standards - User friendly introduction
| From: | Alan Knowles | Date: | Fri, 21 Dec 2001 12:08:46 +0000 |
| Subject: | Re: Coding standards - User friendly introduction | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-3648@lists.php.net to get a copy of this message | ||
I do apologise for starting this (not so productive discussion)
What I think can be gained (if anything) is a soft introduction to the coding
standard document - at present, they jump straight in to detailing the standards, with little
justification and softening up of the reader - And I guess that is where the any of these threads start
rather that real issues with the standard it'self....
I should really put my efforts into working out which of the classes I've got lying arround would be
valuable and get them a bit closer to the PEAR standard :)
This probably duplicates some things on the site, but if you want to use it as a standard response
when threads like this start up again.....
RTFM :)
PEAR Coding Standards.
----------------
Why have a standard?
Unlike any other code or class repository, PEAR aims to provide php developers with a core set of tools
that reduce the need to re-invent the wheel, everytime they attempt to create a php application.
To do this, anybody using, reading, contributing or extending a 'standard' library should expect a
the interface to the library to be consistant. This is where the PEAR library differs from any other.
----------------
I dont like the standards......
The standards, love them or hate them are standards. PHP is a rich language and offers many ways around
the fact that these standards may not suit your programming style. The primary one is the ability to extend a
PEAR class and put your own interface onto them eg.
my_underscore_db extends DB {
function connect_to_database($connect_string) {
$this->connect($connect_string);} } while this would not be acceptable to core PEAR, there is no reason you can not wrap PEAR to suit your prefered style. (or have this available as a 'alternive/Backward compatible file' within your class directory --------------- Do I have to do all that indenting and formating as it says.? In the long term it benifits both you and the end users of the library, As time evolves more tools will become available to simply the reformating of your code into the 'PEAR' standard format, if it doesnt exist, why not write it... --------------- Ive got this great class, but it's not formatted for PEAR, is there any point in me contributing? Yes, You can not only save yourself time in the long run, but may find ideas that you didnt think of that improve your own code. First propose the class on the mailing list or fill in the proposal form and listen to the responses you will probably get suggestions about where in the PEAR structure it should go, and it's name. you should then apply for an account with PEAR online. If the code is not formated, or names are not compatible, you will probably get suggestions from the mailing list, otherwise if other PEAR contributors want to help you out, then they may even help you update your code. - while this happens you class will be classified as alpha. As soon as the core API makes sense to everybody, (it may already, you might not have to change anything), the code will be classed as beta. - at this point, if it hasnt already, It would be expected that the formating be changed to use the standard indentation, brackets etc. and phpdoc comments added. When all this is done, (or pretty much done) it will be classed as devel or stable At any of these points, the code will be may be made available from the PEAR download section. --------------- Go ahead - join the mailing list or fill out the proposal form....