Author: dylan
Date: 2004-12-16 00:51:55 -0500 (Thu, 16 Dec 2004)
New Revision: 417
Modified:
trunk/docs/guidelines.txt
Log:
small additions.
Modified: trunk/docs/guidelines.txt
===================================================================
--- trunk/docs/guidelines.txt 2004-12-16 05:39:48 UTC (rev 416)
+++ trunk/docs/guidelines.txt 2004-12-16 05:51:55 UTC (rev 417)
@@ -7,28 +7,45 @@
* Text
* Use four spaces to indent code.
- * "vim: set ts=4 sw=4 expandtab si ai sta:" is ideal.
- I'm sure Emacs has the equivalent.
+ * Try to wrap code somewhere between 96 and 104 chars, depending
+ on preference and the code in question.
+ A line should never need to be longer than 104 chars.
+ * "vim: set ts=4 sw=4 expandtab si ai sta tw=104:" is ideal for this.
+ I'm sure Emacs has the equivalent.
* Use K&R brace style. Opening braces should be on the same line as the
statement,
and only a newline should follow (eg: if (3) {, while (3) {, sub insane
{, etc)
* Pad operators except commas with one or more spaces on each side
* Pad commas with one or more spaces on the right hand side (Obvious)
+ * Of course, don't pad -> at all.
+ * Don't use => as a lazy way of quoting things.
+ GOOD: foo => 'bar', baz => 'quux'
+ BAD: foo => bar => baz => 'quux' <-- this confuses the hell out of me.
+
* Variables
- * Use clear names
- * Declare every variable with either our or my.
+ * Variable names should be easy to grok.
+ * Declare every variable with either our or my. We do not use "use vars".
* Lexical variables should be in all lowercase, with _ seperating words.
($like_this, not $LikeThis, please)
* Global variables or lexical variables in the scope of an entire file
should be
have the first letter of each 'word' upper cased ($Like_This).
* Functions
+ * Just as variables, function names should be meaningful.
+ verb-noun is recommended, for example:
+ is_insane($dylan) # returns boolean
* Functions and methods should mostly use named arguments,
except where that seems silly. Named arguments should
be all lower case and start with a dash.
Note that as of 2004-12-15 very little if any haver
code follows this, as previously it was not a guideline.
+* Methods
+ * These should be all lower case, and have meaningful names.
+ * For constructors, use the poetic syntax: "new Object".
+ * For all other methods, Object->method is preferred.
+
+
* Commenting
* Use tags vim/emacs knows about like FIXME, TODO, and XXX,
when appropriate.