this post was submitted on 28 Mar 2024
317 points (96.2% liked)

Programmer Humor

18971 readers
848 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
[–] [email protected] 11 points 4 months ago* (last edited 4 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"

[–] [email protected] 2 points 4 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

[–] [email protected] 1 points 4 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)