Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Comments
Message
From
05/02/2019 21:52:21
 
 
To
05/02/2019 20:52:03
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01665935
Message ID:
01665941
Views:
67
>>>HI All,
>>>
>>>This has been a pet-peeve of mine for some time. A long long time ago, when disk space was sparse, comments in code was frowned on. Too many comments would bring sever finger shaking at me. "We can not afford wasting disk space!" OK. That was then, this is now, with terabytes of disk space, why not take the time and place a comments as to what the code is intended to do? I still see new code with very little to no comments to help me follow the purpose of the code. Not to mention (ok, i will), planning the flow of the code ahead of coding.
>>>
>>>Why is this? Should I be striping the comments out before sharing it with others, and to help confuse myself years later when I revisit the code for maintenance?
>>>
>>>Only looking for comments on the subject. ;)
>>
>>https://www.codeproject.com/Articles/872073/Code-Comments-are-Lies
>
>
>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.
>
I am a strong believer of Als link - code should speak for itself. If it doesn't, variables, functions and methods are not named well enough.
Parameters and returns should be described to allow usage without reading the method code.

But apart from that, there are few things to comment: whenever there was a need to code against project best practices (often performance tweaks) and a list of approaches tried, but NOT taken or abandoned, best with a pointer to source control where it was active. Also ideas not tried yet (often also performance)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform