cvs: peardoc /en/chapters standards.xml
| From: | Jon Parise | Date: | Thu, 20 Dec 2001 19:09:03 +0000 |
| Subject: | cvs: peardoc /en/chapters standards.xml | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-1644@lists.php.net to get a copy of this message | ||
jon Thu Dec 20 14:09:03 2001 EDT
Modified files:
/peardoc/en/chapters standards.xml
Log:
- Clarify note about PEAR coding standards
- Add 'softtabstop' to the list of vim settings
- Add a section on class naming
- Correct the number of columns in the function naming example table
Index: peardoc/en/chapters/standards.xml
diff -u peardoc/en/chapters/standards.xml:1.1 peardoc/en/chapters/standards.xml:1.2
--- peardoc/en/chapters/standards.xml:1.1 Fri Dec 14 12:10:58 2001
+++ peardoc/en/chapters/standards.xml Thu Dec 20 14:09:02 2001
@@ -1,12 +1,12 @@
<?xml encoding="iso-8859-1"?>
-<!-- $Revision: 1.1 $ -->
+<!-- $Revision: 1.2 $ -->
<chapter id="standards">
<title>Coding Standards</title>
<note>
<simpara>
- The PEAR Coding Standards applies to code that is to become a part
- of PEAR, either distributed with PHP or available for download via
- PEAR's install tool.
+ The PEAR Coding Standards apply to code that is part of the official
+ PEAR distribution (that is, either distributed with PHP or available
+ for download from the PHP PEAR repository).
</simpara>
</note>
<sect1 id="standards.indenting">
@@ -31,6 +31,7 @@
<programlisting role="vim">
set expandtab
set shiftwidth=4
+ set softtabstop=4
set tabstop=4
</programlisting>
</para>
@@ -351,6 +352,27 @@
<sect1 id="standards.naming">
<title>Naming Conventions</title>
<sect2>
+ <title>Classes</title>
+ <para>
+ Classes should be given descriptive names. Avoid using abbreviations
+ where possible. Class names should always begin with an uppercase
+ letter. The PEAR class hierarchy is also reflected in the class name,
+ each level of the hierarchy separated with a single underscore.
+ Examples of good class names are:
+ <informaltable>
+ <tgroup cols="3">
+ <tbody>
+ <row>
+ <entry><simpara>Log</simpara></entry>
+ <entry><simpara>Net_Finger</simpara></entry>
+ <entry><simpara>HTML_Upload_Error</simpara></entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </informaltable>
+ </para>
+ </sect2>
+ <sect2>
<title>Functions and Methods</title>
<para>
Functions and methods should be named using the "studly caps"
@@ -360,7 +382,7 @@
the name (after the prefix) is lowercase, and each letter that
starts a new "word" is capitalized. Some examples:
<informaltable>
- <tgroup cols="3">
+ <tgroup cols="4">
<tbody>
<row>
<entry><simpara>connect()</simpara></entry>