5 ms·
And remember, the next maintainer could very well be you.
by Attummm 3y ago
And remember, the next maintainer could very well be you.
- SaintGhurka 3y agoOr it could be a homicidal maniac.
- Gabriel_Martin 3y agoOr both, depending on how readable it is
- dasil003 3y agoYeah, it's humbling enough when you are reviewing some old code and thinking "what idiot wrote this" only to git blame and realize it was you. What's even more jarring when you find some code, surprised the capability/feature even exists, then git blame and realize again it was you (this time hopefully with a pat on your own back because of how well it's written). Yes this has happened to me.
- JohnFen 3y agoAll of the code I wrote more than a year or two before the time I look at it strikes me as being embarrassing. I hope this is always true, because I think it says that I have grown as a programmer over that time.
- roflyear 3y agoI recently had the opposite experience: encountered some code from 2017(!!!) that was really solid. Few "silly" things but the important stuff was there. I realized that when I did that project I "had the time to care" which is not the case lately!
- LordDragonfang 3y agoNothing beats the feeling of having a coworker suggest what might be a substantial change to a codebase you haven't touched in months, only for you to look at the code and realize that the way you wrote it makes it a one- or two-line change.
- Arrath 3y agoPerfect opening for the classic "well its a good thing I hate myself!" joke.
- jedberg 3y agoWhen I do personal projects for myself, I try to comment them really well for this exact reason. Just today in fact I was trying to update some code I wrote two years ago because one of the underlying tools broke. I was very happy with past me for commenting the workflow of that tool so I could easily work around it.
- majikandy 3y agoA good alternative is code without comments that communicates just as well as that code without the comments. Not necessarily better but less likely to slip out of sync with the comments upon change.
- jedberg 3y agoI'm a big fan of self documenting code, but especially when I'm doing quick and dirty projects for myself, where I value speed and cleverness over correctness, the comments really help. Especially when it comes to explaining past me's cleverness.
- deleted 3y ago[deleted]
- majikandy 3y agoYes I was only really referencing production long lived code. Mostly I’m a big fan of quick and dirty being something that doesn’t really exist. I believe in quick and throwaway and quick and single/multi use. Comments are fine, just the original suggestion I was referencing sounded like they were a priority.
- Mawr 3y agoIt's not an alternative, you can't obviate the need for comments with code. What you're supposed to do is write the code as clearly as possible and then add comments for anything you couldn't manage to express in the code. Usually that'd be all the context around why the code is the way it is and isn't the way it isn't.