Skip to main content
6 events
when toggle format what by license comment
Jun 17, 2024 at 7:48 comment added Matthieu M. @SimonGeard: I think it depends what you're commenting for. As I mentioned I use those 5 lines as "section separators", and my files typically have only one such separator (between the public section first, and the implementation section second), so 5 lines is fine... and really helps pinpointing it in the outline. For doc comments on methods, I don't "waste" lines.
Jun 16, 2024 at 20:41 comment added Simon Geard @MatthieuM. That's a bit too much whitespace for my taste - in general I wouldn't want more than one blank line and one comment - but not unreasonable.
Jun 15, 2024 at 10:36 comment added Matthieu M. As an example, I typically separate sections of code in my file with 5 lines. In order: a blank line, a comment line with no text, a comment line with the section title, a comment line with no text, and another blank line. This is lightweight to maintain, and pops out sufficiently in the file outline in the IDE to quickly jump from section to section.
Jun 14, 2024 at 0:31 comment added Simon Geard @Flater "So would whitespace" - well, yes, that's why I explicitly said "a blank line and a short comment". Providing visual cues - including both whitespace and comments - is a useful technique for improving code readability, even if the question is a terrible example of how to do that correctly.
Jun 13, 2024 at 4:26 comment added Flater "Since any IDE will render comments in a different colour, having a blank line and a single short comment at the top of a block of code can help the eye spot the logical sections." So would whitespace, and that would be easier to write, maintain, and navigate by cursor.
Jun 12, 2024 at 22:08 history answered Simon Geard CC BY-SA 4.0