DEV Community

Discussion on: 6 ways minimalism can help you write clean code

Collapse
 
kenovienadu profile image
Ovienadu Ken

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.

Collapse
 
theweeappshop profile image
Tony Ross

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.

Collapse
 
paulasantamaria profile image
Paula Santamaría

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.

Thread Thread
 
theweeappshop profile image
Tony Ross

Ah, my mis-understanding Paula. Totally agree with you then.

Thread Thread
 
moopet profile image
Ben Sinclair

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".

Collapse
 
paulasantamaria profile image
Paula Santamaría • Edited

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.

Collapse
 
kenovienadu profile image
Ovienadu Ken

🤗🤗🤗 then I couldn't agree with you more