hypnotic_nerd@programming.dev to Programmer Humor@programming.devEnglish · 9 months agoManager: This task only takes 30 minutes. Why did it take you the whole day?programming.devimagemessage-square102fedilinkarrow-up1813arrow-down18
arrow-up1805arrow-down1imageManager: This task only takes 30 minutes. Why did it take you the whole day?programming.devhypnotic_nerd@programming.dev to Programmer Humor@programming.devEnglish · 9 months agomessage-square102fedilink
minus-squaredeadbeef79000@lemmy.nzlinkfedilinkarrow-up8·edit-28 months agoP1000x this. I can read a diff. I need to know why. No, a code comment isn’t good enough, it’s out of date after the next commit.
minus-squareDontTakeMySky@lemmy.worldlinkfedilinkarrow-up1·8 months agoCode comments for "why"s that persist. Commits for why’s that are temporary. If you need to run X before Y, add a comment. If you added X before why because it was easier, leave it in a commit
minus-squaredeadbeef79000@lemmy.nzlinkfedilinkarrow-up2·8 months ago If you need to run X before Y… Add a test that asserts that.
minus-squareDontTakeMySky@lemmy.worldlinkfedilinkarrow-up2·8 months agoWith a comment on the test detailing why it matters so people don’t just assume the test is out of date when it fails. And ideally test the underlying result of x before y, not the fact that x is called before y. And while we’re at it, assert in Y that X has been called, and again comment the reason for the preconditions.
P1000x this.
I can read a diff.
I need to know why.
No, a code comment isn’t good enough, it’s out of date after the next commit.
Code comments for "why"s that persist. Commits for why’s that are temporary.
If you need to run X before Y, add a comment. If you added X before why because it was easier, leave it in a commit
Add a test that asserts that.
With a comment on the test detailing why it matters so people don’t just assume the test is out of date when it fails.
And ideally test the underlying result of x before y, not the fact that x is called before y.
And while we’re at it, assert in Y that X has been called, and again comment the reason for the preconditions.