aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/docs/coding-guidelines.html
diff options
context:
space:
mode:
authorCallum Macrae <callum@lynxphp.com>2012-05-03 22:34:35 +0100
committerCallum Macrae <callum@lynxphp.com>2012-05-03 22:34:35 +0100
commit06efa6c0beac3cb4fed0e7412c3b60f91f4181bb (patch)
treef9bc6ce1f5ccc9d92f1ec6960017371a17cc4210 /phpBB/docs/coding-guidelines.html
parentee2e2cb2c36d7abf7571d2593061eedfdf5edb8f (diff)
downloadforums-06efa6c0beac3cb4fed0e7412c3b60f91f4181bb.tar
forums-06efa6c0beac3cb4fed0e7412c3b60f91f4181bb.tar.gz
forums-06efa6c0beac3cb4fed0e7412c3b60f91f4181bb.tar.bz2
forums-06efa6c0beac3cb4fed0e7412c3b60f91f4181bb.tar.xz
forums-06efa6c0beac3cb4fed0e7412c3b60f91f4181bb.zip
[ticket/10855] Added JS camelCaps info to guidelines.
PHPBB3-10855
Diffstat (limited to 'phpBB/docs/coding-guidelines.html')
-rw-r--r--phpBB/docs/coding-guidelines.html10
1 files changed, 8 insertions, 2 deletions
diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html
index be78ad0b3b..237bc18d20 100644
--- a/phpBB/docs/coding-guidelines.html
+++ b/phpBB/docs/coding-guidelines.html
@@ -295,11 +295,17 @@ PHPBB_QA (Set board to QA-Mode, which means the updater also c
<p>We will not be using any form of hungarian notation in our naming conventions. Many of us believe that hungarian naming is one of the primary code obfuscation techniques currently in use.</p>
<h4>Variable Names:</h4>
- <p>Variable names should be in all lowercase, with words separated by an underscore, example:</p>
+ <p>In PHP, variable names should be in all lowercase, with words separated by an underscore, example:</p>
<div class="indent">
<p><code>$current_user</code> is right, but <code>$currentuser</code> and <code> $currentUser</code> are not.</p>
</div>
+
+ <p>In JavaScript, variable names should use camel caps:</p>
+
+ <div class="indent">
+ <p><code>currentUser</code> is right, but <code>currentuser</code> and <code>current_user</code> are not.</p>
+ </div>
<p>Names should be descriptive, but concise. We don't want huge sentences as our variable names, but typing an extra couple of characters is always better than wondering what exactly a certain variable is for. </p>
@@ -317,7 +323,7 @@ for ($i = 0; $i &lt; $outer_size; $i++)
</pre></div>
<h4>Function Names:</h4>
- <p>Functions should also be named descriptively. We're not programming in C here, we don't want to write functions called things like "stristr()". Again, all lower-case names with words separated by a single underscore character. Function names should preferably have a verb in them somewhere. Good function names are <code>print_login_status()</code>, <code>get_user_data()</code>, etc. </p>
+ <p>Functions should also be named descriptively. We're not programming in C here, we don't want to write functions called things like "stristr()". Again, all lower-case names with words separated by a single underscore character in PHP, and camel caps in JavaScript. Function names should preferably have a verb in them somewhere. Good function names are <code>print_login_status()</code>, <code>get_user_data()</code>, etc. Constructor functions in JavaScript should begin with a capital letter.</p>
<h4>Function Arguments:</h4>
<p>Arguments are subject to the same guidelines as variable names. We don't want a bunch of functions like: <code>do_stuff($a, $b, $c)</code>. In most cases, we'd like to be able to tell how to use a function by just looking at its declaration. </p>