You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kafka.apache.org by jj...@apache.org on 2012/06/04 22:08:05 UTC

svn commit: r1346136 - /incubator/kafka/site/coding-guide.html

Author: jjkoshy
Date: Mon Jun  4 20:08:05 2012
New Revision: 1346136

URL: http://svn.apache.org/viewvc?rev=1346136&view=rev
Log:
Update coding convention for setters and getters.

Modified:
    incubator/kafka/site/coding-guide.html

Modified: incubator/kafka/site/coding-guide.html
URL: http://svn.apache.org/viewvc/incubator/kafka/site/coding-guide.html?rev=1346136&r1=1346135&r2=1346136&view=diff
==============================================================================
--- incubator/kafka/site/coding-guide.html (original)
+++ incubator/kafka/site/coding-guide.html Mon Jun  4 20:08:05 2012
@@ -28,7 +28,7 @@ We are following the style guide given <
 <li>Constants should be camel case with an initial capital <code>LikeThis</code> not <code>LIKE_THIS</code>.</li>
 <li>Prefer a single top-level class per file for ease of finding things.</li>
 <li>Do not use semi-colons unless required.</li>
-<li>Avoid getters and setters.</li>
+<li>Avoid getters and setters - stick to plain <code>val</code>s or <code>var</code>s instead. If (later on) you require a custom setter (or getter) for a <code>var</code> named <code>myVar</code> then add a shadow <code>var myVar_underlying</code> and override the setter (<code>def myVar_=</code>) and the getter (<code>def myVar = myVar_underlying</code>).</li>
 <li>Perfer Option to null in scala APIs.</li>
 <li>Use named arguments when passing in literal values if the meaning is at all unclear, for example instead of <code>Utils.delete(true)</code> prefer <code>Utils.delete(recursive=true)</code>.
 <li>Indentation is 2 spaces and never tabs. One could argue the right amount of indentation, but 2 seems to be standard for scala and consistency is best here since there is clearly no "right" way.</li>
@@ -99,4 +99,4 @@ We are following the style guide given <
 <li>We should attempt to maintain API compatibility when possible, though at this point in the project's lifecycle it is more important to make things good rather avoid breakage.</li>
 </ul>
 
-<!--#include virtual="includes/footer.html" -->
\ No newline at end of file
+<!--#include virtual="includes/footer.html" -->