Click here to Skip to main content

Welcome to the Lounge! RSS Feed     


For lazing about and discussing anything in a software developer's life that takes your fancy.

The Lounge is rated PG. If you're about to post something you wouldn't want your kid sister to read then don't post it. No flame wars, no abusive conduct and please don't post ads.

Technical discussions are welcome, but if you need specific help please use the programming forums.


 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page  Show 
  Refresh
GeneralRe: Commentaries - above or below the code? Pinmembercaposada1:42 12 Nov '09  
GeneralRe: Commentaries - above or below the code? PinmemberThomasVanderhoof3:26 12 Nov '09  
GeneralRe: Commentaries - above or below the code? PinmemberBunnyFaber3:32 12 Nov '09  
GeneralRe: Commentaries - above or below the code? PinmemberTrudyH3:36 12 Nov '09  
GeneralRe: Commentaries - above or below the code? PinmemberMichael Doyle4:50 12 Nov '09  
GeneralRe: Commentaries - above or below the code? Pinmemberp51dfltln6:44 12 Nov '09  
GeneralRe: Commentaries - above or below the code? PinmemberStuart Rubin8:09 12 Nov '09  
I always defer to my favorite software book Code Complete for these kinds of questions. McConnell spends a whole chapter talking about best practices in writing comments. (This may seem silly to some, but if you read the book, it makes a TON of sense.) Chapter 32 states plainly "Use comments to prepare the reader for what is to follow", and explains the well-established convention of putting comments above the code it's documenting.
 
Further (and this is the fun part you can show your professor), he claims "This idea isn't always taught in programming classes, but it's a well-established convention in commercial practice."
 
Well-established conventions, until there is a clear technical reason to do otherwise, should be followed!
 
Also, there has been some discussion hinting that well-crafted code should not need comments. My thought is all about how fast you can look at code to quickly understand what it's supposed to do. Your brain doesn't waste time translating variable names (even if they're well named), doing math, finding control loop conditions, etc.
 
Stuart
GeneralRe: Commentaries - above or below the code? PinmemberAlan Burkhart9:49 12 Nov '09  
GeneralRe: Commentaries - above or below the code? PinmemberTrevortni9:57 12 Nov '09  
GeneralRe: Commentaries - above or below the code? Pinmemberpatbob8:34 16 Nov '09  
GeneralI've just found my ideal job. PinmvpPete O'Hanlon2:16 11 Nov '09  
GeneralRe: I've just found my ideal job. PinmemberNagy Vilmos3:33 11 Nov '09  
GeneralRe: I've just found my ideal job. Pinmember1.21 Gigawatts3:35 11 Nov '09  
GeneralRe: I've just found my ideal job. PinmemberMedia2r4:02 11 Nov '09  
GeneralRe: I've just found my ideal job. PinmemberRussell Jones4:36 11 Nov '09  
GeneralRe: I've just found my ideal job. PinmemberMedia2r4:41 11 Nov '09  
GeneralRe: I've just found my ideal job. PinmvpPete O'Hanlon4:10 11 Nov '09  
GeneralRe: I've just found my ideal job. PinmemberRoger Wright4:43 11 Nov '09  
GeneralRe: I've just found my ideal job. PinmemberRichardM114:39 12 Nov '09  
GeneralRe: I've just found my ideal job. Pinmemberjeron15:06 11 Nov '09  
GeneralArmistice Day PinPopularmemberTony Richards1:08 11 Nov '09  
GeneralRe: Armistice Day PinmemberDalek Dave1:10 11 Nov '09  
GeneralRe: Armistice Day Pinmembermerridus1:13 11 Nov '09  
GeneralRe: Armistice Day PinmemberTony Richards1:16 11 Nov '09  
GeneralRe: Armistice Day PinmemberDalek Dave1:15 11 Nov '09  

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

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


Advertise | Privacy | Mobile
Web03 | 2.5.120210.1 | Last Updated 14 Feb 2012
Copyright © CodeProject, 1999-2012
All Rights Reserved. Terms of Use
Layout: fixed | fluid