Closed Thread
Results 1 to 7 of 7

Thread: PEAR Standard

  1. #1
    Jordan Guest

    PEAR Standard

    I found this in a Google search. The website isn't there anymore but the cached version is.

    ActionApps - Coding Standards

    We encourage ActionApps developers to follow the coding standards described bellow. It help us to have the code as readable as possible for everyone.

    Most of the following rules comes from php PEAR standard http://pear.php.net/manual/en/standards.php
    Most important rules on tne top:

    * use UNIX end of lines (use \n and never windows \r\n)

    If we mix both modes, the CVS diffs are unusefull
    * Indent 4 spaces, with no tabs

    Do not use Tabs or use 'insert Tabs as spaces' option of your text editor. Most of the editors (like Jedit or HomeSite) allows it. Then the code will look good in any editor.
    * Use PHP functions up to version 4.0.6

    * <?php open tag

    Do not use any other shorted version like <?, .. There are some problems on some Apache configurations with <?...
    * comments should follow phpDoc standard

    See http://phpdocu.sourceforge.net/
    - use /* */ and // for comments, not #
    * control structures should look like

    if ((condition1) || (condition2)) {
    commands;
    } else {
    commands;
    }

    - open brace at the end of line
    - if, while, ... separated by space (it is not function call)

    * function($var1, $var2=true)

    No space between function name and open brace allow us easier find the function in the code.
    * 80 characters wide

    Try to write the code 80 characters wide, if possible.
    * quote strings in indexes

    Allways qoute strings like 'name' in $arr['name'] or $db->f('name') although current PHP do not need it.
    * use $_GET, $POST, and $_SERVER

    Use mentioned superglobal arrays to access variables from forms ...
    * use return true; instead of return(true);

    Return is the statement, not a function.
    * When you commiting changes into CVS, allways update CHANGES file and send a note to apc-aa-coders@sourceforge.net

    * Document new feature in the FAQ (http://apc-aa.sourceforge.net/faq/) and in the code

    * If it is possible, create an example of new feature on Sourceforge installation of ActionApps

    * If you changing database structure (adding table, ...), you should update sql_update.php3 script

    * Before you are going to code some new feature, let us know about, please (apc-aa-coders@sourceforge.net)


    I know the current code do not strictly follows mentioned rules, but from this time it will ....... hopefully

    Honza Malik, 1/29/2003

  2. CODECALL Circuit advertisement

     
  3. #2
    Jordan Guest
    Check out the link in the post above for more info:

    http://pear.php.net/manual/en/standards.php

  4. #3
    moonrise is offline Learning Programmer
    Join Date
    May 2006
    Posts
    40
    Rep Power
    0
    that was a informative post thanks buddy

  5. #4
    kromagnon is offline Learning Programmer
    Join Date
    Jun 2006
    Posts
    50
    Rep Power
    0
    I hate putting the open brace at the end of a line... it makes my soul cry. This is how I always do it:
    Code:
    for(int i; i < 3; i ++)
    {
        some code
        some code
        some code
        some code
    }
    <!-- comment comment comment --></

  6. #5
    TkTech's Avatar
    TkTech is offline The Crazy One
    Join Date
    Jun 2006
    Location
    Canada
    Posts
    1,412
    Blog Entries
    1
    Rep Power
    31
    Jordan, the site is still there, http://actionapps.org/aa/doc/coding.html

  7. #6
    Join Date
    Jul 2006
    Posts
    16,491
    Blog Entries
    75
    Rep Power
    143
    I'm with you, Kromagnon, but I can live with either style. It's a holdover from when I coded in Pascal and had to use "begin" and "end" instead of { and }.
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  8. #7
    dirkfirst is offline Programming Expert
    Join Date
    May 2006
    Posts
    354
    Rep Power
    23
    I prefer the { on the line of the function

    Code:
    int main () {
    }

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. PHP: Ping with Pear
    By Jordan in forum PHP Tutorials
    Replies: 14
    Last Post: 09-20-2010, 03:57 PM
  2. Installing PEAR
    By Ivenius in forum PHP Development
    Replies: 4
    Last Post: 09-05-2010, 08:03 AM
  3. PEAR mail failed to connect socket error
    By 123np in forum PHP Development
    Replies: 1
    Last Post: 06-17-2010, 06:43 AM
  4. Help with PEAR mail
    By 123np in forum PHP Development
    Replies: 1
    Last Post: 06-03-2010, 05:26 AM
  5. PEAR
    By mikelbring in forum PHP Development
    Replies: 4
    Last Post: 12-04-2008, 03:11 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts