You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by bu...@apache.org on 2012/11/03 14:24:47 UTC

svn commit: r837137 - in /websites/staging/directory/trunk/content: ./ apacheds/coding-standards.html apacheds/developers-guide.html

Author: buildbot
Date: Sat Nov  3 13:24:47 2012
New Revision: 837137

Log:
Staging update by buildbot for directory

Added:
    websites/staging/directory/trunk/content/apacheds/coding-standards.html
Modified:
    websites/staging/directory/trunk/content/   (props changed)
    websites/staging/directory/trunk/content/apacheds/developers-guide.html

Propchange: websites/staging/directory/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Sat Nov  3 13:24:47 2012
@@ -1 +1 @@
-1404885
+1405329

Added: websites/staging/directory/trunk/content/apacheds/coding-standards.html
==============================================================================
--- websites/staging/directory/trunk/content/apacheds/coding-standards.html (added)
+++ websites/staging/directory/trunk/content/apacheds/coding-standards.html Sat Nov  3 13:24:47 2012
@@ -0,0 +1,239 @@
+<!DOCTYPE html>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<html>
+	<head>
+		<title>Coding Standards &mdash; Apache Directory</title>
+		
+        <link href="./../css/common.css" rel="stylesheet" type="text/css">
+    	<link href="./../css/green.css" rel="stylesheet" type="text/css">
+    
+	</head>
+	<body>
+	    <div id="container">
+            <div id="header">
+                <div id="subProjectsNavBar">
+                    <a href="./../">
+                        
+                        Apache Directory Project
+                        
+                    </a>
+                    &nbsp;|&nbsp;
+                    <a href="./../apacheds">
+                        
+                        <STRONG>ApacheDS</STRONG>
+                        
+                    </a>
+                    &nbsp;|&nbsp;
+                    <a href="./../studio">
+                        
+                        Apache Directory Studio
+                        
+                    </a>
+                    &nbsp;|&nbsp;
+                    <a href="./../api">
+                        
+                        Apache LDAP API
+                        
+                    </a>
+                </div><!-- subProjectsNavBar -->
+            </div><!-- header -->
+            <div id="content">
+                <div id="leftColumn">
+                    
+<div id="navigation">
+    
+    <h5>ApacheDS 2.0</h5>
+    <ul>
+        <li><a href="./../apacheds/">Home</a></li>
+        <li><a href="./../apacheds/features.html">Features</a></li>
+    </ul>
+    <h5>Downloads</h5>
+    <ul>
+        <li><a href="./../apacheds/downloads.html">ApacheDS 2.0.0-M8</a>&nbsp;&nbsp;<img src="./../images/new_badge.gif" alt="" style="margin- bottom:- 3px;" border="0"></li>
+        <li><a href="./../apacheds/download-old-versions.html">Older versions</a></li>
+    </ul>
+    <h5>Documentation</h5>
+    <ul>
+        <li><a href="./../apacheds/basic-users-guide.html">Basic User's Guide </a></li>
+        <li><a href="./../apacheds/advanced-users-guide.html">Advanced User's Guide</a></li>
+        <li><a href="./../apacheds/developers-guide.html">Developer's Guide</a></li>
+        <!--li><a href="./../apacheds/gen-docs/latest">Generated Reports (e.g. JavaDocs)</a></li-->
+    </ul>
+    
+    
+    <h5>Support</h5>
+    <ul>
+        <li><a href="./../mailing-lists-and-irc.html">Mailing Lists &amp; IRC</a></li>
+        <li><a href="./../sources.html">Sources</a></li>
+        <li><a href="./../issue-tracking.html">Issue Tracking</a></li>
+        <li><a href="./../commercial-support.html">Commercial Support</a></li>
+    </ul>
+    <h5>Community</h5>
+    <ul>
+        <li><a href="./../contribute.html">How to Contribute</a></li>
+        <li><a href="./../team.html">Team</a></li>
+        <li><a href="./../original-project-proposal.html">Original Project Proposal</a></li>
+        <li><a href="./../special-thanks.html" class="external-link" rel="nofollow">Special Thanks</a></li>
+    </ul>
+    <h5>About Apache</h5>
+    <ul>
+        <li><a href="http://www.apache.org/">Apache</a></li>
+        <li><a href="http://www.apache.org/licenses/">License</a></li>
+        <li><a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li>
+        <li><a href="http://www.apache.org/foundation/thanks.html">Thanks</a></li>
+        <li><a href="http://www.apache.org/security/">Security</a></li>
+    </ul>
+    
+</div><!-- navigation -->
+
+                </div><!-- leftColumn -->
+                <div id="rightColumn">
+
+
+
+<h1 id="coding-standards">Coding Standards</h1>
+<p>Welcome to you, developper ! You have been elected committer on the project, or you want to contribute some code or some patch? This is great news. However, in order to be able to share your 'vision' and your code, some rules must be followed.</p>
+<p>Hey, remember that those rules are not the best nor the worst, they are pretty much what they are for historical reasons, or for technical reasons, however, please, accept them as they are, and avoid religious war (please, oh please, no mail to say "WTF ? You are using spaces instead of tab ??? How stupid is this rule etc etc.) Rules are <em><em>alway</em>s</em> stupid, but smart people follow them ;)</p>
+<p><DIV class="note" markdown="1">
+<strong>eclipse IDE</strong></p>
+<p>Eclipse users can import those two files to enfore the code formating : <a href="http://svn.apache.org/repos/asf/directory/project/trunk/resources/formatting.xml">formatting.xml</a> and <a href="http://svn.apache.org/repos/asf/directory/project/trunk/resources/codetemplates.xml">codetemplates.xml</a>
+</DIV></p>
+<p><DIV class="note" markdown="1">
+<strong>IDEA IDE</strong></p>
+<p>IDEA users can import <a href="settings.jar">this file</a> to enfore the code formating.
+</DIV></p>
+<h2 id="headers">Headers</h2>
+<p>First, you <strong>must</strong> (and this rule accept no exception) use this header in top of all source file, or each file in which you can have comments :</p>
+<div class="codehilite"><pre><span class="cm">/*</span>
+<span class="cm"> *  Licensed to the Apache Software Foundation (ASF) under one</span>
+<span class="cm"> *  or more contributor license agreements.  See the NOTICE file</span>
+<span class="cm"> *  distributed with this work for additional information</span>
+<span class="cm"> *  regarding copyright ownership.  The ASF licenses this file</span>
+<span class="cm"> *  to you under the Apache License, Version 2.0 (the</span>
+<span class="cm"> *  &quot;License&quot;); you may not use this file except in compliance</span>
+<span class="cm"> *  with the License.  You may obtain a copy of the License at</span>
+<span class="cm"> *</span>
+<span class="cm"> *    http://www.apache.org/licenses/LICENSE-2.0</span>
+<span class="cm"> *</span>
+<span class="cm"> *  Unless required by applicable law or agreed to in writing,</span>
+<span class="cm"> *  software distributed under the License is distributed on an</span>
+<span class="cm"> *  &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY</span>
+<span class="cm"> *  KIND, either express or implied.  See the License for the</span>
+<span class="cm"> *  specific language governing permissions and limitations</span>
+<span class="cm"> *  under the License.</span>
+<span class="cm"> *</span>
+<span class="cm"> */</span>
+</pre></div>
+
+
+<h3 id="classinterface-headers">Class/Interface headers</h3>
+<p>Each <strong>Class</strong> or <em>Interface</em> should have an header which must contains :</p>
+<ul>
+<li>A descrption of this class/interface</li>
+<li>
+<p>an <em>author</em> tag which should be :</p>
+<div class="codehilite"><pre><span class="nd">@author</span> <span class="o">&lt;</span><span class="n">a</span> <span class="n">href</span><span class="o">=</span><span class="s">&quot;mailto:dev@directory.apache.org&quot;</span><span class="o">&gt;</span><span class="n">Apache</span> <span class="n">Directory</span> <span class="n">Project</span><span class="o">&lt;/</span><span class="n">a</span><span class="o">&gt;</span>
+</pre></div>
+
+
+</li>
+</ul>
+<p><DIV class="note" markdown="1">
+Thanks to avoid to put your name. The code is not yours, and much more important, but putting ypur name and e-mail, you will intimidate other developper ("Oh, no, I won't mess with this code, it has been developped by XXXX !") and second, you will receive mail in three years even if you have stopped all commitment on the project (and those who have sent you an e-mail will think that the project's memeber are not responsive...)
+</DIV></p>
+<p>If you use <strong>html</strong> tags, remember to escape '&lt;' and '&gt;' characters...</p>
+<h3 id="static-members-and-other-members">Static members and other members</h3>
+<p>Just add a single line javadoc comment like : <em>/*<em> blah ... </em>/</em> before each member</p>
+<h3 id="methods">Methods</h3>
+<p>Follow the standard <strong>javadoc</strong> rules : Description, <strong>@param</strong>, <strong>@exception</strong> and <strong>@return</strong>. It should be enough. Avoid <strong>@tags</strong>, <strong>@todo</strong> tags, etc...</p>
+<p>Escape <strong>html</strong> characters</p>
+<h2 id="comments">Comments</h2>
+<p>No special rules, except that you should avoid :</p>
+<ul>
+<li>Useless comments like : i++; /* Increment i */</li>
+<li>Overusing comments : if you have to heavily comment a peice of code, then this piece of code might be too complex ...</li>
+<li>Speading little comments all over a method : if possible, write blocs of comments. The method header could hgenerally contains a full description of the code, and if it's not the case, just consider your method might be too long !</li>
+<li>Dead code commented. If it's dead, then put it in a cuffin. We use SVN, the Ressuscitator !</li>
+</ul>
+<p>Basically, use your common sense :-)</p>
+<h2 id="naming">Naming</h2>
+<p>Naming ! Sounds like Blaming :-). Ok. We use <strong>Sun(tm/c/r)</strong> style :</p>
+<ul>
+<li>Constants are in UPPER CASE with accepted '_'</li>
+<li>Class starts with an uppercase and each starting word is upper cased. No '_', please !</li>
+<li>Methods starts with lower case and then follow the same rule than classes. No '_', please !</li>
+<li>Interfaces should not start with an 'I'</li>
+<li>Classes which implements an Interface must be followed by the postfix 'impl'</li>
+<li>Variables follow the method naming convention. No '_', please !</li>
+<li>Use meaningfull names.</li>
+<li>No double letter variables like ii, jj etc...</li>
+</ul>
+<p>If you browse the code, you will see that many classes does not respect those rules. That's life ! Don't fix it if you don't touch a class. If you are fixing a method in a class, then you can change the code to respect the rules. Little by little, we may reach a stable state where all the code respect the rules ;)</p>
+<p>Naming is really important for <strong>APIs</strong>. Be smart. If you are not sure, ask.</p>
+<h2 id="spaces-vs-tabs">Spaces vs tabs</h2>
+<p><DIV class="warning" markdown="1">
+<strong>FOUR SPACES, NO TAB. Final.</strong>
+</DIV></p>
+<p>No discussion. Using tabs break diffs. Modify your <strong>IDE</strong> to insert spaces when you use tabs, before it saves the file.</p>
+<h2 id="formatting">Formatting</h2>
+<p>Use the <strong>formatting.xml</strong> file which can be found in the <strong>resources</strong> directory in the root of the project. This is for <em>Eclipse</em>. If you don't use eclipse, then translate the formating to your favorite <strong>IDE</strong>.</p>
+<p>Use the <strong>codetemplates.xml</strong> file if you are using <em>Eclipse</em> too. You will find it at the same location. It brings you some standard headers for new classes, nex methods, etc.</p>
+<p>Use <strong>UTF-8</strong> as a default for your files (except for properties, thanks to <strong>java</strong>, which should be in <strong>ISO-8859-1</strong>). Forget about exotic encoding...</p>
+<p><DIV class="warning" markdown="1">
+<strong>DO NOT USE AN AUTOMATIC FORMATER FOR COMMENTS!!!</strong>
+</DIV></p>
+<p>People spend a lot of time making their comment looks like pretty, so if you just format them, you will have to recover the previous comments...</p>
+<p>Some general rules :</p>
+<ul>
+<li>Always use '{' and '}' even for a single instruction, or if you have an empty block (don't use ';' for empty blocks)</li>
+<li>No more than one instruction on a single line, the only exception is the '?' ':' operation</li>
+<li>Use <em>this</em> to address the class variable if there is a risk of confusion (for instanc eif you have a parameter with the same name.</li>
+<li>Don't add a 'a_', or 'the_' before a parameter's name to distinguish it from the class variable which has the same name. Use <strong>this</strong> instead.</li>
+<li>Don't add <strong>final</strong> everywhere. Even if <strong>final</strong> is a substitute for <strong>const</strong>, it's semantic is not clear enough that you use it everywhere.</li>
+<li>Add spaces in method calls after '(' and before ')'</li>
+<li>'{' and '}' must be on the same column</li>
+</ul>
+<p>This is a code example :</p>
+<div class="codehilite"><pre><span class="o">...</span>
+<span class="kt">int</span> <span class="n">result</span> <span class="o">=</span> <span class="n">myMethod</span><span class="o">(</span> <span class="n">param1</span><span class="o">,</span> <span class="n">param2</span> <span class="o">)</span>
+
+<span class="k">if</span> <span class="o">(</span> <span class="n">result</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="o">)</span>
+<span class="o">{</span>
+    <span class="c1">// do something</span>
+<span class="o">}</span>
+<span class="o">...</span>
+</pre></div>
+
+
+<h2 id="imports">Imports</h2>
+<p>Always declare all the classes you import, do not use <strong>x.y.*</strong></p>
+<h2 id="what-else">What else ?</h2>
+<p>Well, this was a very short introduction about coding rules. Use commen sense, look at what you see around you when adding some code, ask people about format, if you have a question.</p>
+<p>That's it ! (I wait your comments, guys :-)</p>
+
+
+
+                </div><!-- rightColumn -->
+                <div id="endContent"></div>
+            </div><!-- content -->
+            <div id="footer">&copy; 2003-2012, <a href="http://www.apache.org">The Apache Software Foundation</a> - <a href="./../privacy-policy.html">Privacy Policy</a><br />
+                Apache Directory, ApacheDS, Apache Directory Server, Apache Directory Studio, Apache LDAP API, Apache Triplesec, Triplesec, Apache, the Apache feather logo, and the Apache Directory project logos are trademarks of The Apache Software Foundation.
+            </div>
+        </div><!-- container -->
+    </body>
+</html>
\ No newline at end of file

Modified: websites/staging/directory/trunk/content/apacheds/developers-guide.html
==============================================================================
--- websites/staging/directory/trunk/content/apacheds/developers-guide.html (original)
+++ websites/staging/directory/trunk/content/apacheds/developers-guide.html Sat Nov  3 13:24:47 2012
@@ -107,7 +107,48 @@
 
 
 <h1 id="developers-guide">Developers Guide</h1>
-<p>Blah...</p>
+<h2 id="getting-the-source-building-the-trunks">Getting the source, Building the trunks</h2>
+<p>To get the source, build the <em>trunks</em> and get along with Maven, follow the instruction given in this page: <a href="advanced-ug/0.2-building-trunks.html">AUG : 0.2. Building trunks</a></p>
+<h2 id="coding-standards">Coding standards</h2>
+<p>The applicable coding standards for ADS 1.5 are described in <a href="coding-standards.html">Coding Standards</a></p>
+<p>There are some more rules, as we are using <strong>Java 5</strong> now :</p>
+<ul>
+<li>Use generics as much as you can. Generic are a good way to avoid casting, and it enforce the usage of the correct type.</li>
+<li>If you can avoid <em>Iterators</em>, do so. There is this cool construction with a <strong>for( Type t:<collection instance> )</strong> : use it !</li>
+<li>Use <strong>assert</strong>. It's usefull, especially instead of a bunch of <strong>if (<test is wrong>)</strong> then throw Exception* when controlling incoming parameters</li>
+<li>Use the new <em>Enum</em> type !</li>
+</ul>
+<h2 id="project-internals">Project Internals</h2>
+<p>The following points describe the differents sub-elements of the server, from the developper point of view :</p>
+<ul>
+<li>[ApacheDS Bootstrapping]</li>
+<li>[ApacheDS Initialization]</li>
+<li>[Apache DS SchemaManager]</li>
+<li>[Interceptors|1.5 Interceptors] mechanism and operations</li>
+<li>Information about [Mitosis], the ADS replication system.</li>
+<li>[Referral Handling Changes]</li>
+<li>[Schema Subsystem Redesign]</li>
+<li>[ACIItem Extensions]</li>
+<li>[Administrative Model Extensions]</li>
+<li>[Account and Password Policy Management]</li>
+<li>[Proposed RFCs]</li>
+<li>[Quartz Schedular Integration]</li>
+<li>[JNDI Bridge and Interceptor Chain Refactoring]</li>
+<li>[Families of Entries]</li>
+<li>[Logging Subsystem]</li>
+<li>[Configuration in DIT (CiDIT)]</li>
+<li>[Versioning and Snapshots]</li>
+<li>[Delegation of Authentication]</li>
+<li>[Core Integration Testing Framework]</li>
+<li>[Xdbm Partition Design]</li>
+<li>[SASL NTLM Support]</li>
+<li>[Supported LDAP Controls, Extended Operations and Features]</li>
+</ul>
+<h2 id="cookbooks">Cookbooks</h2>
+<ul>
+<li>[Template|Cookbook Documentation Template]</li>
+<li>[Example|Cookbook Documentation Example].</li>
+</ul>