You are viewing a single thread.
View all comments View context
5 points
*

This is why I usually don’t comment on stuff like this in PRs. If it’s readable and easy to understand it doesn’t need more abstractions. Even if it’s less code. What’s it save like a few bytes? That’s not as useful as the whole team instantly knowing how the code works when they see it lol

I will say though if a jr dev came upon the last code they would just look it up and learn something so that’s a total valid path too. Just depends on your codebase and how your team works. I think it usually ends up being a mix with larger teams.

permalink
report
parent
reply
7 points

There’s more to it imho. The first three are more prone to mistakes than the last. You are much less likely to accidentally alter the logic intended in a simple null coalesce than you are in if statements.

permalink
report
parent
reply
0 points

That’s fair but if you had proper test coverage there wouldn’t be much risk. Who has that though? Lol

permalink
report
parent
reply
4 points

None of my projects had time for reliable testing unfortunately. It was always “next sprint” or “when we have time” which never really came to fruition.

permalink
report
parent
reply
0 points

Yeah, I think there is a tipping point between terse and magic. I might grimace a little at the first one, have no comment on the middle two, and definitely comment on the last one. Wrote code like the person troubleshooting it is on-call, mildly hung over, and it’s 3am.

permalink
report
parent
reply

Programmer Humor

!programmerhumor@lemmy.ml

Create post

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

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.

Community stats

  • 4.4K

    Monthly active users

  • 1.5K

    Posts

  • 35K

    Comments