4 ms·
> Why was this done this way? It'd be so much easier just to do this instead If there is a reason for it being done 'this way' that is not obvious then there s
by koyote 5y ago
> Why was this done this way? It'd be so much easier just to do this instead
If there is a reason for it being done 'this way' that is not obvious then there should be a comment in the code explaining the thought process.
A commit won't really help you as much there as future refactoring might obscure the original commit that added the code.
That being said, if there's some complexity in what is being solved I will usually add a very quick description of it in the commit message "Used XYZ algorithm to implement ABC due to it being faster/cleaner. See: ticket/wiki/documentation".
- m000 5y ago> there should be a comment in the code explaining the thought process Totally agree. Unofortunately, a descriptive git commit the best you can require without starting a religious war in the team. You won't believe how many developers zealously subscribe to the "no comments needed - good code is self-explanatory" crap. Or throw in the "comments will quickly become outdated" excuse.
- soulofmischief 5y agoIn my experience, the code produced by these kinds of coworkers is neither good nor self-explanatory.