DEV Community

loading...

Discussion on: How To Write Comments

Collapse
daviddalbusco profile image
David Dal Busco

Haha I love the "Zombie code 🧟‍♂️" term!!!

About 4. I would say that a comment is not bad if prefixed with // TODO:. Even maybe better if the todo reference an issue in the tracker as you suggest.

Thank for the share 👍

Collapse
alexanderjanke profile image
Alex Janke

I got used to using // FIXME: for these scenarios so they stick out. A bug should be higher prio than a normal todo in my opinion

Collapse
daviddalbusco profile image
David Dal Busco

Oh pretty cool tips and tricks 👍

Do you use // TODO: and // FIXME: "only" or any other granularity?

Thread Thread
ekeijl profile image
Edwin • Edited

// @TODO for things that should be improved/refactored in the future.
// @FIXME for things that are in a broken/buggy state.

There is a risk that nobody will ever look at these comments again and they remain there to rot in the codebase. This works best if you add a ticket number from your issue tracker (Jira/GitHub issues) so any developer can find context information about it, so:

// @FIXME #321: Temporary fix for XYZ, remove when this ticket is done

Thread Thread
alexanderjanke profile image
Alex Janke

I use this one here marketplace.visualstudio.com/items...
Apart from TODO and FIXME I also use // HACK: 😆 That's about it

Thread Thread
daviddalbusco profile image
David Dal Busco

@alexanderjanke : Haha I might use the // HACK: way more often than it should be allowed 😅. Thanks for feedback, might probably gonna try to enrich my todos with these ideas.

@ekeijl : Agree with you, works best with a ticket number, if not even a must