On Sat, Jul 21, 2001 at 04:20:20PM +0200, Hojtsy Gabor wrote:
> What do people here think about adopting the PEAR
> coding standars to PHP code in the PHP Manual and
> on the PHP website? Identing, control structures,
> functions, naming conventions, etc. We should
> promote the usage of this standard IMHO.

I think that that coding standard are great, especialy in team development.
But coding standard are more than a bounch of rules, it a way of programming.
And exactly that is what makes it hard to start a coding convention just like that.

Every programmer has it's own programming style. For example an if-statement can be 
written in a few styles.
With coding conventions every has to USE the same style. Also comments are important 
(and not only in CVS).

At out work we're program in a lot of programming languages (php, asp, c(++), etc). To 
make it easy for a new employee
to start in our team. every function has a header like this:

/*
        Author:         Dave Mertens, july 21, 2001
        Task:           Get user information from database
        arguments:      
                DbConn          - Active database connection
                UserID          - User identification
        returns
                0               success
                1               error - no db connection
                2               error - no user with UserID='X'
/*
function GetUserFromDatabase($DbConn, $UserID)

You don't have to know what it does, but you can use it. Ofcourse this is one example 
of a convention.

But what about files names?? In the directory /pear/HTTP there's a file Compress.php. 
By it's name you don't see
it's a class. Same thing with functions and implementation files. At my work classes 
start with class-*.php, functions with
function-*.php and implementation don't have a prefix.

Again, coding conventions are OK, but they hard to implement in an project that 
already exists. 
Maybe if we all start writing the coding standards that we're all using write now. 
After that someone should collect everything
and put it all in one document.

Currently, i can't say that there's a coding standard in the pear directory.

Dave Mertens
[EMAIL PROTECTED]

Reply via email to