Click here to Skip to main content
15,912,578 members

Survey Results

What most improves the readability of source code?   [Edit]

Survey period: 24 Mar 2008 to 31 Mar 2008

Reviewing or even learning someone else's code can be hard work. What's the best way to make code easily approachable for someone else?

OptionVotes% 
Obvious and intuitive names for variables, classes and methods64238.31
Clear and useful comments29417.54
Wise use of Whitespace945.61
Correct Spelling and grammar60.36
Limits on file, class and method sizes281.67
Clear and concise code logic and structure39323.45
The use of common coding patterns and practices1649.79

View optional text answers (58 answers)


 
GeneralRe: Narrative Pin
firegryphon25-Mar-08 7:48
firegryphon25-Mar-08 7:48 
GeneralRe: Narrative Pin
Tim Yen25-Mar-08 13:12
Tim Yen25-Mar-08 13:12 
GeneralA lost art: Clear and concise code logic and structure Pin
Nemanja Trifunovic24-Mar-08 3:57
Nemanja Trifunovic24-Mar-08 3:57 
GeneralRe: A lost art: Clear and concise code logic and structure Pin
Shog924-Mar-08 6:47
sitebuilderShog924-Mar-08 6:47 
GeneralRe: A lost art: Clear and concise code logic and structure Pin
Alan Balkany25-Mar-08 3:21
Alan Balkany25-Mar-08 3:21 
GeneralRe: A lost art: Clear and concise code logic and structure Pin
Shog925-Mar-08 7:37
sitebuilderShog925-Mar-08 7:37 
GeneralRe: A lost art: Clear and concise code logic and structure Pin
Tim Yen25-Mar-08 13:15
Tim Yen25-Mar-08 13:15 
GeneralBesides CListCtrl.NET ? Pin
W Balboos, GHB24-Mar-08 1:21
W Balboos, GHB24-Mar-08 1:21 
Of the options, only two shouldn't be taken for granted - that you're not looking at poor coding practices to begin with.

Clear naming conventions (that means camel style) can be considered a step in the direction of self-documenting code. Even with that, I feel the liberal sprinkling of comments is essential: Coda nd Icecream is better with lots of spinkles.

My mind, at this point, is growing feeble. A year or two after I write some code, I would like to know what it does - or more specifically - why I did something in a particular way when a more obvious mechanism exists. To help me keep track, I have 3-level documentation with the project (aside from any rightups I have to give to my employer).

1) At the code level - very very many end-of-line comments.  Some comments for blocks.<br />
2) A header for each method describing what the purpose is and a running history of fixes and changes.  Sometimes the change gets a date-tag in the code, too.<br />
3) A seperate file (I usually use projectName.ver) describing the development, changes, updates, fixes, gutting-events, etc.  This is useful to map new problems to changes (the Pillsbury Dough-Boy effect).


With the above 3 levels of documentation, I need not fret of current or future "senior moments."

For class libraries, when there's a quite period, I write an instruction manual in the hopes that other developers will use them.

Of all the choices, pretty much everything you need to document is in the first two - and the remainder are valid primarily in the context that the more poorly code is written, the more difficult it will be to understand/debug/enhance.


Document code for others as you would have others document code for you!

"The difference between genius and stupidity is that genius has its limits." - Albert Einstein

"How do you find out if you're unwanted if everyone you try to ask tells you to go away?" - Balboos HaGadol



GeneralRe: Besides CListCtrl.NET ? Pin
Gary Wheeler25-Mar-08 7:18
Gary Wheeler25-Mar-08 7:18 
GeneralRe: Besides CListCtrl.NET ? Pin
W Balboos, GHB25-Mar-08 7:19
W Balboos, GHB25-Mar-08 7:19 
GeneralAll Of Above Pin
Gautam Jain23-Mar-08 20:25
Gautam Jain23-Mar-08 20:25 
GeneralRe: All Of Above Pin
Vasudevan Deepak Kumar24-Mar-08 0:20
Vasudevan Deepak Kumar24-Mar-08 0:20 
GeneralRe: All Of Above Pin
Ernest Laurentin24-Mar-08 4:34
Ernest Laurentin24-Mar-08 4:34 
GeneralSorry - that's too easy! Pin
Chris Maunder24-Mar-08 19:38
cofounderChris Maunder24-Mar-08 19:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.