www.icetips.com  Icetips Utilities Documentation 7/2/2012    

Coding conventions

Previous  Top  Next  


I follow pretty strict coding convention that makes the code look good and hopefully very readable to our users.  People use different styles for writing code and I have mine.  Since i also work with case sensitive languages I try very hard to make sure that things are always kept in the same kind of capitalization so it's not too difficult for me to jump from one project to the next!

 

The rules are simple:

 

1.Two (2) character indents.  This has not been enforced in some of the products that we have taken over from other developers but we have been working on it.
2.CODE statement is in column 2.  There are exceptions to this rule where it is in column 1.  Following code should be the same indent as the CODE statement.
3.Mixed case statements, i.e. KeyCode() instead of keycode() or KEYCODE() 
4.Upper case logical keywords, i.e. NOT, AND, OR
5.Only full upper case keywords are SELF and PARENT
6.Never, EVER use period (.) instead of End, ever!  There are, however, exceptions to this in some of the product code that we have taken over.  I never use the period in my code!  The exceptions are always single lines, like:
 
If SELF.GetHdr(HeaderID) = False Then Return .
 
7.Space between statements and arithmetic characters, such as X + 1 instead of X+1 or S & X instead of S&X
8.Clarion properties are upper cased PROP then mixed case, i.e. PROP:LineHeight
9.Constructors and Destructors are declared after other methods in both the declaration (.inc) and implementation (.clw) files.
10.Class properties are declared before methods.  There may be exceptions to this during development when isolating specific methods and properties but in product builds this rule should always be followed.
11.Comments that indicate updates/fixes generally always start with TWO exclamation marks (!!) initials of the developers (AB) and the date in YYYY-MM-DD order, like:
 
!! AB 2012-06-25:  Problem with calculation fixed.
 
12.Every method is identified with a !== comment line above and !-- comment line below. Above the !== line should be two empty lines to separate methods from one another.

 



Direct link to this page: http://www.icetips.com/manuals/utilities/codingconventions.htm