▲ 87 ▼ Self-documenting Code (lackofimagination.org) submitted 2 years ago by Aijan@programming.dev to c/programming@programming.dev 72 comments fedilink hide all child comments
[–] traches@sh.itjust.works 47 points 2 years ago (1 child) Agreed. OP was doing well until they replaced the if statements with ‚function call || throw error’. That’s still an if statement, but obfuscated. permalink fedilink source parent hideshow 2 child comments replies: [–] BrianTheeBiscuiteer@lemmy.world 6 points 2 years ago (1 child) Don't mind the || but I do agree if you're validating an input you'd best find all issues at once instead of "first rule wins". permalink fedilink source parent hideshow 2 child comments replies: [–] rooster_butt@lemm.ee 3 points 2 years ago Short circuiting conditions is important. Mainly for things such as: if(Object != Null && Object.HasThing) ... Without short circuit evaluation you end up with a null pointer exception. permalink fedilink source parent
[–] BrianTheeBiscuiteer@lemmy.world 6 points 2 years ago (1 child) Don't mind the || but I do agree if you're validating an input you'd best find all issues at once instead of "first rule wins". permalink fedilink source parent hideshow 2 child comments replies: [–] rooster_butt@lemm.ee 3 points 2 years ago Short circuiting conditions is important. Mainly for things such as: if(Object != Null && Object.HasThing) ... Without short circuit evaluation you end up with a null pointer exception. permalink fedilink source parent
[–] rooster_butt@lemm.ee 3 points 2 years ago Short circuiting conditions is important. Mainly for things such as: if(Object != Null && Object.HasThing) ... Without short circuit evaluation you end up with a null pointer exception. permalink fedilink source parent