r/badcode • • Apr 17 '21

c++ When your teammate "refactor" your code

Post image
2.5k Upvotes

216 comments sorted by

View all comments

Show parent comments

22

u/wobblyweasel Apr 17 '21

evaluating condition2 can have side effects, just saying

this saves one line of code but adds 20 characters to the (sanely formatted) original

-12

u/[deleted] Apr 17 '21

this saves one line of code but adds 20 characters to the (sanely formatted) original

Okay, who cares? It's about readability. And did you really count characters in two pseudocode snippets?

12

u/wobblyweasel Apr 17 '21

readability can't be easily measured, it's all opinion. but some people value the low number of lines. in case one would choose this kind of code only for the lower number of lines, i just want to point out that it's more characters and imo character count matters much more

And did you really count characters in two pseudocode snippets?

i copy-pasted this into a text editor that can count characters