this post was submitted on 28 Mar 2024
324 points (96.3% liked)

Programmer Humor

19512 readers
913 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] Enoril@jlai.lu 11 points 7 months ago* (last edited 7 months ago) (6 children)

I don’t see the benefit of this long naming convention...

It still allow bug to exist... like the fact that, with this code, the player can still play with 0 Hp.

Should have been better to put a "if(health <= 0)" instead of "< 0"

[–] stockRot@lemmy.world 2 points 7 months ago (1 children)

It sounds like the only concern you have with code is its bugginess, which is short sights. This is unfortunately better documented code than stuff I've seen in production. Obviously no one should do this, but let's not act like there's no benefit

[–] Enoril@jlai.lu 1 points 7 months ago

Indeed, you can achieve a better result with less verbose naming convention. And choose better variable name to make it obvious than 0 Hp is death. While i don’t like having too verbose variable name (as it impacts the readability and quick understanding of the function), i’m not against that for the function name... without going too far of course!

Best is too have proper datamodeling of the object manipulated on top of some classic basic comments. Good interface contract is also a minimum. Best is to have full datamodeling of all the services, objects, in and out interactions between them, etc.

Documentation is a mandatory piece of the code delivery (with tests being the other important part) far too much forgotten if you don't enforce it on your teams.

load more comments (4 replies)