(file) Return to PegasusProgrammingGuidelines.htm CVS log (file) (dir) Up to [Pegasus] / pegasus / doc / WorkPapers

Diff for /pegasus/doc/WorkPapers/PegasusProgrammingGuidelines.htm between version 1.1 and 1.2

version 1.1, 2001/07/05 20:25:19 version 1.2, 2001/12/13 14:53:30
Line 15 
Line 15 
  
 <b>AUTHORS:</b>&nbsp;M. Brasher, K. Schopmeyer <b>AUTHORS:</b>&nbsp;M. Brasher, K. Schopmeyer
 <p><font size="1">Last Update <!--webbot bot="Timestamp" <p><font size="1">Last Update <!--webbot bot="Timestamp"
 S-Type="EDITED" S-Format="%A, %B %d, %Y %I:%M %p" startspan -->Thursday, July 05, 2001 05:15 PM<!--webbot bot="Timestamp" i-CheckSum="5835" endspan -->  S-Type="EDITED" S-Format="%A, %B %d, %Y %I:%M %p" startspan -->Thursday, July 26, 2001 06:10 PM<!--webbot bot="Timestamp" i-CheckSum="6014" endspan -->
 </font></p> </font></p>
 <p>Revision Status</p> <p>Revision Status</p>
 <table border="1" width="80%"> <table border="1" width="80%">
Line 32 
Line 32 
     <td width="25%">first Draft</td>     <td width="25%">first Draft</td>
   </tr>   </tr>
   <tr>   <tr>
     <td width="25%">&nbsp;</td>      <td width="25%">0.2</td>
     <td width="25%">&nbsp;</td>      <td width="25%">24 July 2001</td>
     <td width="25%">&nbsp;</td>      <td width="25%">M. Brasher, K. Schopmeyer</td>
     <td width="25%">&nbsp;</td>     <td width="25%">&nbsp;</td>
   </tr>   </tr>
   <tr>   <tr>
     <td width="25%">&nbsp;</td>      <td width="25%">0.3</td>
     <td width="25%">&nbsp;</td>      <td width="25%">26 July 2001</td>
     <td width="25%">&nbsp;</td>      <td width="25%">K. Schopmeyer</td>
     <td width="25%">&nbsp;</td>      <td width="25%">Add documentation on licensing.</td>
   </tr>   </tr>
   <tr>   <tr>
     <td width="25%">&nbsp;</td>     <td width="25%">&nbsp;</td>
Line 58 
Line 58 
  
 <p>NOTE: This is a draft copy for comment.</p> <p>NOTE: This is a draft copy for comment.</p>
  
   <p>RULES and GUIDELINES - A number of the guidelines below are absolute rules
   that we must follow in the Pegasus project.&nbsp; These are the things that will
   help insure portability and effective interoperability of the components.</p>
   
   <p>Other area are &quot;guidelines&quot; that we strongly suggest be followed
   so that 1) the code will be readable and usable, 2) we develop a single look to
   our source code, etc.&nbsp; In some cases, there may be reasons to bypass some
   of these guidelines but we strongly encourage everybody to follow them.&nbsp;
   In fact, if there is a real reason we will change to what the group wants and
   suggestions.</p>
   
 <h2>Coding Conventions</h2> <h2>Coding Conventions</h2>
 <OL> <OL>
 <LI><b>Indenting Code</b> - Indent by increments of 4 characters (with tabsize of <LI><b>Indenting Code</b> - Indent by increments of 4 characters (with tabsize of
 8).&nbsp; ??? Using Tabs???.  8).&nbsp; Use the TAB character.&nbsp; This is the accepted norm for open source
     code.
  
 <LI><b>Naming Conventions</b> -&nbsp;&nbsp;&nbsp;<font face="Courier New"> ThisIsAClassName</font> - no underscores. <LI><b>Naming Conventions</b> -&nbsp;&nbsp;&nbsp;<font face="Courier New"> ThisIsAClassName</font> - no underscores.
   <font face="Courier New">   <font face="Courier New">
Line 73 
Line 85 
 <LI><b>Code Line Length</b> - Lines should not span more than 80 columns. <LI><b>Code Line Length</b> - Lines should not span more than 80 columns.
 When methods span more than 80 columns, do this: When methods span more than 80 columns, do this:
 <pre> <pre>
 &nbsp;&nbsp;&nbsp; void MyClass::myMethod(      void MyClass::myMethod(
   
 &nbsp;&nbsp;&nbsp;               const char* someReallyLongName, &nbsp;&nbsp;&nbsp;               const char* someReallyLongName,
   
 &nbsp;&nbsp;&nbsp;               const char* someOtherReallyLongName); &nbsp;&nbsp;&nbsp;               const char* someOtherReallyLongName);
 </pre> </pre>
 <LI> Use "char* x" rather than "char *x".  <LI> Use "char* x" rather than "char *x". Either is normally legal for the
 <LI><b>Use of <font face="Courier New">const</font></b>. Use const whenever possible.    majority of compilers.
 Use const methods whenever possible.  <LI><b>Use of <font face="Courier New">const</font></b>. Use <font face="Courier New"> const</font> whenever possible.
   Use <font face="Courier New"> const</font> methods whenever possible.
 <LI><b>Braces</b> -&nbsp; Put opening brace on a line by itself. Braces must be aligned with control keyword: <LI><b>Braces</b> -&nbsp; Put opening brace on a line by itself. Braces must be aligned with control keyword:
 <pre> <pre>
         for(...)         for(...)
Line 93 
Line 104 
 <pre>   for (...) <pre>   for (...)
           {           {
           ....           ....
           }            }</pre>
 </pre>  or this:<pre>   for (...){
               ....
          }</pre>
 <LI><b>Using Space</b> - No spaces after names. <LI><b>Using Space</b> - No spaces after names.
 <br>Separate functions with blank lines. <br>Separate functions with blank lines.
 <pre>    class X <pre>    class X
Line 119 
Line 132 
   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; blah3);</font>&gt;/pre&gt;<br>   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; blah3);</font>&gt;/pre&gt;<br>
 <LI> <LI>
   <pre>Avoid this:   <pre>Avoid this:
 </pre>  
 <pre>  
         int        x;         int        x;
         float      y;         float      y;
 </pre> </pre>
Line 165 
Line 177 
     platform.     platform.
  
 Always write a regression test for everything. Always write a regression test for everything.
 <p>No warnings should be committed.  <p>No files with warnings should be committed to CVS.
  
 Test big changes on at least Windows and Unix (or Linux) Test big changes on at least Windows and Unix (or Linux)
  
Line 192 
Line 204 
 reasons to use outside code and libraries at times. Thus, for example, the reasons to use outside code and libraries at times. Thus, for example, the
 initial project used the ACE_wrappers libraries extensively but with the initial project used the ACE_wrappers libraries extensively but with the
 objective of eventually providing a replacement.&nbsp; That replacement has been objective of eventually providing a replacement.&nbsp; That replacement has been
 produced, partly because ACE was not available on all of the platforms</p>  produced, partly because ACE was not available on all of the platforms.</p>
   
   <p>All code submitted to the Pegasus core source libraries is to be made available
   under the standard license used by Pegasus.&nbsp; If any code is to be taken
   from other open source projects, we expect that the code recognize both the
   requirements of the Pegasus standard license and the other license (ex. if we
   were to share code with the Caldera OpenWBEM) project, we would have to show
   both their license and our licenses.</p>
   
   <p>All code input to the Pegasus project must include the license statement.</p>
   
   <p>If there is a case of code that we want to use on the Pegasus project but
   that is licensed outside of the above rules, it can be included only with the
   specific permission of the Pegasus project management.&nbsp; We will be very
   hesitant to do this since it could mean weakening the whole open source nature
   of the project and would greatly complicate our license arrangements.</p>
  
 <h2>Using Make</h2> <h2>Using Make</h2>
  
Line 215 
Line 242 
 <p>&lt;&lt;&lt;THIS SECTION NEED TO BE COMPLETED&gt;&gt;&gt; <p>&lt;&lt;&lt;THIS SECTION NEED TO BE COMPLETED&gt;&gt;&gt;
 </p> </p>
  
   <h2>Portability Issues</h2>
   
   <OL>
   <LI>In .h files the following identifiers must be surrounded by the PEGASUS_STD() macro (which
   pretends std:: to the argument).<br>
   <br>
   <font face="Courier New">           ostream<br>
               istream<br>
               cout<br>
               cerr<br>
   </font><br>
           Do not use this macro in .cpp files. Instead put the following<br>
           at the beginning of the file:<br>
   <br>
               PEGASUS_USING_STD;<br>
   <br>
   <LI>The following does not compile with some compilers.<br>
   <br>
               class X<br>
               {<br>
               public:<br>
   <br>
                   static const Uint32 COLOR = 225;<br>
               };<br>
   <br>
           Use this instead:<br>
   <br>
               class X<br>
               {<br>
               public:<br>
   <br>
                   static const Uint32 COLOR;<br>
               };<br>
   <br>
           And place this in the .cpp file:<br>
   <br>
               const Uint32 X::COLOR = 255;<br>
   <br>
           Or use enumerated types:<br>
   <br>
               class X<br>
               {<br>
               public:<br>
   <br>
                   enum { COLOR = 225 };<br>
               };<br>
   </OL>
   
 <h2>The Source Tree Structure</h2> <h2>The Source Tree Structure</h2>
  
 <p>We work from a single source tree in CVS.&nbsp; We have a fixed structure for <p>We work from a single source tree in CVS.&nbsp; We have a fixed structure for


Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2