Click here to Skip to main content
15,921,697 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: The Art of Writing Comments :: Software Engineering Pin
Matt Gullett22-Nov-02 18:03
Matt Gullett22-Nov-02 18:03 
GeneralRe: The Art of Writing Comments :: Software Engineering Pin
Hockey22-Nov-02 18:16
Hockey22-Nov-02 18:16 
GeneralRe: The Art of Writing Comments :: Software Engineering Pin
Ranjan Banerji22-Nov-02 18:07
Ranjan Banerji22-Nov-02 18:07 
GeneralRe: The Art of Writing Comments :: Software Engineering Pin
Hockey22-Nov-02 18:12
Hockey22-Nov-02 18:12 
GeneralRe: The Art of Writing Comments :: Software Engineering Pin
valikac22-Nov-02 18:29
valikac22-Nov-02 18:29 
GeneralRe: The Art of Writing Comments :: Software Engineering Pin
Michael Dunn22-Nov-02 19:23
sitebuilderMichael Dunn22-Nov-02 19:23 
GeneralRe: The Art of Writing Comments :: Software Engineering Pin
Michael P Butler23-Nov-02 2:10
Michael P Butler23-Nov-02 2:10 
GeneralRe: The Art of Writing Comments :: Software Engineering Pin
Gary R. Wheeler23-Nov-02 2:58
Gary R. Wheeler23-Nov-02 2:58 
The best advice I ever received on commenting was this:

"If you can say it in code, do so. Otherwise, say it in a comment." - Dan Saks, secretary of the ANSI C++ Standard committee

In other words, you should write your code to be as readable as possible. The more readable your code is, the less commenting you should need to do to explain it.

There are all sorts of things you do to make your code readable:
  • Have a naming convention. Define the convention so that you can look at a variable name and tell important things about the name without looking up its definition.
  • Use descriptive names. Names like ClassX, ClassQ23, don't tell you anything about what they do. Names like BuyerClass, SellerClass, KernelWaitForCrash() tell you what they are about.
  • Use a consistent style: Place braces, parentheses, etc. consistently.
  • Code conservatively. For example, just because you can override the multiplication operator for two strings doesn't mean you should do so.
  • If you work with other people, sit down at the start of a project and agree on how you're going to do these things.




Software Zen: delete this;
GeneralRe: The Art of Writing Comments :: Software Engineering Pin
valikac23-Nov-02 5:49
valikac23-Nov-02 5:49 
GeneralRe: The Art of Writing Comments :: Software Engineering Pin
loic28-Nov-02 1:52
loic28-Nov-02 1:52 
GeneralCOM+fopen - relative path Vs Absolute path Pin
devvvy22-Nov-02 16:57
devvvy22-Nov-02 16:57 
GeneralRe: COM+fopen - relative path Vs Absolute path Pin
Anders Molin23-Nov-02 0:45
professionalAnders Molin23-Nov-02 0:45 
Generalmemory slot and installed memory size/type Pin
JimBello22-Nov-02 14:18
JimBello22-Nov-02 14:18 
GeneralRe: memory slot and installed memory size/type Pin
alex.barylski22-Nov-02 18:24
alex.barylski22-Nov-02 18:24 
General'diff' algorithm Pin
moliate22-Nov-02 12:43
moliate22-Nov-02 12:43 
GeneralRe: 'diff' algorithm Pin
Shog922-Nov-02 13:05
sitebuilderShog922-Nov-02 13:05 
GeneralRe: 'diff' algorithm Pin
moliate22-Nov-02 15:29
moliate22-Nov-02 15:29 
GeneralRe: 'diff' algorithm Pin
Scott H. Settlemier23-Nov-02 6:32
Scott H. Settlemier23-Nov-02 6:32 
GeneralRe: 'diff' algorithm Pin
moliate25-Nov-02 8:58
moliate25-Nov-02 8:58 
Generalextracting dialog box to use in other program Pin
IrishSonic22-Nov-02 13:36
IrishSonic22-Nov-02 13:36 
GeneralRe: extracting dialog box to use in other program Pin
Christian Graus22-Nov-02 14:01
protectorChristian Graus22-Nov-02 14:01 
GeneralRe: extracting dialog box to use in other program Pin
IrishSonic22-Nov-02 14:12
IrishSonic22-Nov-02 14:12 
GeneralRe: extracting dialog box to use in other program Pin
Christian Graus22-Nov-02 14:14
protectorChristian Graus22-Nov-02 14:14 
GeneralRe: extracting dialog box to use in other program Pin
IrishSonic23-Nov-02 5:37
IrishSonic23-Nov-02 5:37 
GeneralFolder Selection Dialog Pin
Dov Sherman22-Nov-02 11:06
Dov Sherman22-Nov-02 11:06 

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.