Suppose, you come up with a solution that does that job in 2 or 3 lines, but it's over-optimized and not very easily readable.
Don't confuse brevity with optimization. Optimized code is all about the number of machine instructions, not how many lines of code it is. There are two-line solutions which are less optimized by an order of magnitude than a 10-line solution.
Pushing commented code in production
Do you mean commented out code? Good, maintainable code is commented, meaning it has comments to help explain intent. Commented out code is code that was turned into a comment to stop it from working.
Always push the former to production; never push the latter at all. (That's what VCS is for.)
P.S. There are rare exceptions, but if you're wondering whether your situation is one of them, it isn't.
As a developer, always consider, manage all the bad scenarios. Make sure your code is ready to face the worst of conditions.
More important than managing the bad scenarios, explicitly test for them.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Don't confuse brevity with optimization. Optimized code is all about the number of machine instructions, not how many lines of code it is. There are two-line solutions which are less optimized by an order of magnitude than a 10-line solution.
Do you mean commented out code? Good, maintainable code is commented, meaning it has comments to help explain intent. Commented out code is code that was turned into a comment to stop it from working.
Always push the former to production; never push the latter at all. (That's what VCS is for.)
P.S. There are rare exceptions, but if you're wondering whether your situation is one of them, it isn't.
More important than managing the bad scenarios, explicitly test for them.