4 ms·
Why not just actually use comments? If it's worth explaining to new developers it'll likely be useful later when you've simply forgotten why something is the wa
by Splognosticus 7y ago
Why not just actually use comments? If it's worth explaining to new developers it'll likely be useful later when you've simply forgotten why something is the way it is.
- cfors 7y agoSeriously. Especially when something seems like a bizarre choice in the code, I'll provide a link if there is a corresponding GitHub issue or code regarding it. I've never had an issue with GitHub issues regarding linkrot, but it happens quite frequently when linking actual source code, especially code not in your control. Not sure what a better solution is for that, unfortunately. I generally justify it by the anecdotal observation that the code is generally not being used anymore by the time the link dies out, but that is far from an ideal justification.
- jakub_g 7y agoAssuming you use GitHub for source control: - Go to GitHub.com repo and find the file (You can use 't' keyboard shortcut to find it) - Press 'y' on keyboard to replace 'master' with its SHA1 in the URL - Click on the interesting line of code - You have a forever-valid link (assuming no push --force) to the exact line of code
- TeMPOraL 7y agoBecause such annotations are for you to help you comprehend, not something you want to actually leave in the codebase.
- retsibsi 7y agoNot trying to be a smartarse, but isn't that what comments are for? If they aid your comprehension, there's a reasonable chance they'll also help someone else in the future.
- TeMPOraL 7y agoThere's overlap, but annotations are more throwaway and task-oriented. Once done with your code study, you wouldn't want to commit to the main repo all the little yellow highlights, the "!!!" notes, the hand-drawn arrows connecting code lines, the "does X, but ask Fred" remarks, etc. Also, separating these out would let one to design tooling that's more suitable for reading and annotating than editing. When studying code, I'd prefer to do it on a tablet, with an experience closer to a PDF reader than IDE.
- retsibsi 7y agoThat makes sense, thanks.