1154
Comenting code (lemmy.ml)
(page 2) 42 comments
sorted by: hot top controversial new old
[-] temmink@feddit.org 3 points 1 month ago

Will each level of smaller clocks get one additional hour?

[-] sjh@sh.itjust.works 3 points 1 month ago

Commenting code is a super important habit to get into—it not only helps others understand your thought process but also makes it easier for you to pick up where you left off if you revisit the code later. Plus, well-commented code can significantly reduce the onboarding time for new developers on a project. Remember, comments should explain the "why" behind the code, not just the "what." For instance, stating why you chose a particular algorithm or data structure can be far more helpful than just labeling it. According to a study by SmartBear, 44% of developers regard poorly documented code as a top cause of project delays, so it’s definitely worth the extra effort!

[-] doktormerlin@feddit.org 2 points 1 month ago

But it's also important to learn that comments should be brief and concise. We have one file from an ex-dev in which there are 750 lines of code and 2000 lines of comment, when someone wants to maintain this code they always have a hard time because this many comments are taking up so much screen real estate that you can't find the code that actually does stuff

[-] shasta@lemm.ee 2 points 1 month ago
[-] ZILtoid1991@lemmy.world 1 points 1 month ago

I only have a 3k monitor, and I can manage it. Sometimes I comment line-by-line even.

[-] chautalees@lemmy.world 3 points 1 month ago

When you ask a Dev to test their own code

[-] stupidcasey@lemmy.world 2 points 1 month ago

It should have the numbers change in the middle like a digital clock but look like the numbers on a clock.

[-] JoYo@lemmy.ml 2 points 1 month ago

someone else's code would have the wrong values.

[-] piko@chaos.social 2 points 1 month ago

@Vordimous Wait for daylight saving time...

[-] Vordimous@lemmy.ml 1 points 1 month ago

Is that when all of the devs write the comments on the line after the code?

[-] russ@cupoftea.social 1 points 4 weeks ago

@Vordimous @linuxgal when I see this sort of thing when reviewing PRs, I write words to the effect of "tell me WHY it's doing that, not WHAT it's doing". The "what" is usually obvious from the code and thus not worthy of comment. The "why" will enlighten your colleagues (and future you).

[-] JokeDeity@lemm.ee 1 points 1 month ago

Is this clock wrong half the time or am I just dumb?

[-] match@pawb.social 2 points 1 month ago

what times do you think might be wrong?

load more comments (1 replies)
load more comments (2 replies)
load more comments
view more: ‹ prev next ›
this post was submitted on 28 Sep 2024
1154 points (100.0% liked)

Programmer Humor

32364 readers
222 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS