Questions tagged [comments]
Questions about writing comments in code.
202 questions
4 votes
5 answers
429 views
Why don't many languages implement an everything-before-is-a-comment symbol?
Python and PowerShell use # to denote to the parser that everything after them until the line break is a comment. They even provide block comments for multiline situations. However, there is no ...
23 votes
9 answers
7k views
Using commented dashes to divide up code chunks [closed]
I'm taking another crack at learning Java with the aim of getting a job. As I write code, I sometimes find it quite difficult to navigate my code using the formatting I often see in tutorials. ...
4 votes
6 answers
666 views
Waiting until end of project to remove commented out code, remove unused code, and resolve compiler warnings
A co-worker of mine is working on project solo but would still like to have other team members review their code upon reaching certain milestones. Unfortunately, they also want to wait until the end ...
9 votes
4 answers
663 views
How to document alternative code I considered but didn't go with due to performance?
I write code in R, and often find myself attempting to optimize the code for better performance. In a given script that tackles a specific problem, I test different code alternatives and compare them ...
2 votes
3 answers
2k views
Versioning a function/method
While this might seem more like a piece of an easy task to others, it's honestly not easy for me. At this stage, I find myself wandering how best to version my functions/methods. What does this mean? ...
50 votes
6 answers
13k views
Is a comment aligned with the element being commented a good practice?
I am a home, amateur developer for 25 years and I just had a bright idea regarding comments. Like all such novel bright ideas, someone has probably already done it and there is probably a consensus on ...
4 votes
5 answers
277 views
Approaches for comment duplication
For code, we know approaches like DRY and we tend to extract common functionality. What approaches are recommended for comments? Perhaps it's a really open question, so I'm going to go with my ...
4 votes
5 answers
284 views
Dealing with unwanted usages of a function
I am writing a function that I would not like to get called given a certain context and am wondering how best to convey that to possible users of the function. Assume, for exemplification, I am ...