Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Comments
Message
From
06/02/2019 08:55:19
 
 
To
06/02/2019 05:01:56
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01665935
Message ID:
01665959
Views:
45
>>>>Only looking for comments on the subject. ;)
>>>
>>>https://www.codeproject.com/Articles/872073/Code-Comments-are-Lies
>
>That guy is right in principle, and in practice he's right most of the time. Rox's rules about comments:
>1. don't tell me what your code does, I can read code
>2. don't tell me how you did this, I can read code, tell me why you did it this way and not the standard way, warn me of a bug you're working around.
>
>>I use comments to pseudo-code a routine before actually writing the code. This generally results in the comments becoming description to a block of related code. Other times I comment a complex equation to emphasize its' purpose. Then sometimes I just add comments so I can remember why I did the coding the way I did. And then with complex SQL statements it is easier to place a comment that describes the intent of the statement then it is to spend time deciphering the lengthy SELECT statement. But in most cases, I fined over commenting less troublesome then the lack of comments when trying to interrupt other peoples code. I try to code for the future maintenance or enhancements.
>
>To the above I add
>
>3. explain the magical numbers.
>
>IOW, comment the nonstandard things, workarounds, why does case lnDummy=4 behave differently from case lnDummy=5, which is which. In case you need to do something stupid, assign the customer her place in eternal memory by putting her name in the comment. With the datetime... for which I actually have an intellisense macro:
>
lparam oFoxCode
>oFoxCode.ValueType="V"
>lnHours=SET("Hours")
>set hours to 24
>lcSetDate=set("date")
>set century on
>set date ymd
>lcReturn= "*["+ttoc(datetime())+"] " +getwordnum(sys(0),2, " #")+ " -"
>set hours to lnHours
>set date to (lcSetDate)
>return lcReturn
I, too, have hotkeys and intellisense macros to add comment lines. I reviewing my (or others) code, if I see or think of something related to the code, I insert a ToDo, BugBug, or Doc comment. Then later I can use the Code Reference tool to locate the various comments. If they still inspire me, I move them to my task list tool.
Greg Reichert
Previous
Reply
Map
View

Click here to load this message in the networking platform