Code Advice "Column"

I've discussed coding style a couple of times before in this blog, and it invariably generates a lot of interest and discussion. It seems I'm not the only one who cares a lot about these issues.

I recently tried to explain the coding style I've used in the Creator designer source base, to somebody else on the team. When I tried to provide references I came up short. There are several coding style guidelines - and I tend to follow the JDK one - but the problem with the official coding style document is that it leaves out a lot! For example, it does not address the Tabs versus Spaces issue (cowards!). I found some other good ones, but I disagree vehemently with some of their rules (like open braces on a separate line, and underscore suffixes and fields, and indentation level 2).

So, I intend to start blogging my opinions on how to write good code. Some will be controversial - especially my first "rule" regarding logging! Note that no rule is absolute - there are always exceptions and you need go consider the tradeoffs and apply good judgement.

I also shouldn't take "full credit". I have not invented most of these practices. Some I have learned from developers whose style I admire. Others have come about as the result of (sometimes heated) discussions with other programmers. And finally, some have I have learned from my own past mistakes.

Take everything with a grain of salt - but I hope you will find these entries, at least some of them, helpful.

Update 10/15/06: Here are the entries as of today:

Comments:

FWIW, one of the better style guides I've seen for Java comes from Howard Fear: http://thefears.com/thoughts/java-style.html I don't agree with all of it, but it is worth reading.

Posted by Gregg Sporar on September 05, 2005 at 04:47 AM PDT #

Post a Comment:
Comments are closed for this entry.
About

Tor Norbye

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today