Disagree about commented code; but there's a time and a place for it. If you have the capability to minify your code, then comments have no place. However, in the overall readability/understandability of a large system, and to assist with debugging, comments are invaluable.
I may have explained myself poorly on that point. I meant that commented-out code has no value. I'm in favor of comments that explain the purpose of code, as long as they add additional value.
I've been a professional C, Perl, PHP and Python developer.
I'm an ex-sysadmin from the late 20th century.
These days I do more Javascript and CSS and whatnot, and promote UX and accessibility.
Commented-out code may sometimes - very rarely - have value, but usually as a warning not to do something. Like in a function document string, something saying "this used to be done like so, but there's a gotcha, so don't refactor it back".
When I was talking about reusability I was referring mostly to reusing your own code. Like, for example, don't write the same function twice with a different name.
But I'm also in favor of reusing code through dependencies, as long as the cost of integrating that dependency is worth taking.
Like with any form of minimalism, there's no "one size fits all", it's about being aware of the cost vs value ratio in your particular case.
It's a beautiful piece. You're very correct. Commented code looks ugly and makes the code difficult for others to read and understand.
You mentioned the dependency clutter. But then you also encourage code reusability. Can you please clarify on this.
Disagree about commented code; but there's a time and a place for it. If you have the capability to minify your code, then comments have no place. However, in the overall readability/understandability of a large system, and to assist with debugging, comments are invaluable.
Great article though.
I may have explained myself poorly on that point. I meant that commented-out code has no value. I'm in favor of comments that explain the purpose of code, as long as they add additional value.
Ah, my mis-understanding Paula. Totally agree with you then.
Commented-out code may sometimes - very rarely - have value, but usually as a warning not to do something. Like in a function document string, something saying "this used to be done like so, but there's a gotcha, so don't refactor it back".
Thank you Ken!
When I was talking about reusability I was referring mostly to reusing your own code. Like, for example, don't write the same function twice with a different name.
But I'm also in favor of reusing code through dependencies, as long as the cost of integrating that dependency is worth taking.
Like with any form of minimalism, there's no "one size fits all", it's about being aware of the cost vs value ratio in your particular case.
🤗🤗🤗 then I couldn't agree with you more