by Anonymous >> Sun, 29 Oct 2006 20:34:29 GMT
Another two bob's worth ...
I'm absolutely with Brendan, John and Alistair; clarity and readability are everything.
I even concede to use i,j as counters for simple loops, but long, descriptive (and carefully thought out) names are the best way to convey meaning. Using a verb-noun notation for method names usually allows easy distinction from properties, etc, so making () unnecessary.
Hungarian Notation became popular in other languages for compiler specific reasons, and just isn't relevant in Jade. An exception I occasionally find useful is prefixing local variables with 'str' within a display formatting method, to distinguish from the native primitive.e.g.
strPaymentAmount := (paymentAmount / 100).userFormat($Dollars).
I like the underscore prefix for parameters because it is less of a distraction than 'p', which can sometimes convey an erroneous meaning at a glance (e.g. "pCode", "pAct", and what is a "pangle", "ploop" or "pupper"?). Underscore also follows the convention (not entirely consistently) used in Jade meta-code.
self isn't necessary for Ctrl1,2 to work. Jade allows parameters and local variables with the same name as properties (was this always allowed?). I've seen this used in 'set' method parameters (no underscore or 'p' required). If you do use this 'feature', then selective use of self can be used to distinguish local variables from class properties.
setValues(code : Integer; .... );
...
self.code := code;
I reckon John makes a good point in his first posting - conventions are fine if followed by the whole team, otherwise inconsistent application can cause confusion than it attempts to avoid. Perhaps Alistair's "the way we each prefer" should taken in moderation (oh no, not the style police!)
Cheers,
Robert