Code golf’s more sensible cousin is code bonsai. You don’t remove something unless the outcome is more elegant.
Don’t do stupid shit like single-letter variables, or cramming everything into one line, or functionifying anything that happens twice. But if you can generalize something that happens a bunch and turn a lot of copy-paste boilerplate into slightly magic-looking function calls, absolutely chop all those blocks down to one name and a couple references.
Code golf’s more sensible cousin is code bonsai. You don’t remove something unless the outcome is more elegant.
Don’t do stupid shit like single-letter variables, or cramming everything into one line, or functionifying anything that happens twice. But if you can generalize something that happens a bunch and turn a lot of copy-paste boilerplate into slightly magic-looking function calls, absolutely chop all those blocks down to one name and a couple references.
And then comment on it, you fucking animal.