4 ms·
"Code happens". In reality, there's code that should have been commented all the time and even in the best codebases. I don't think there's a coder in the world
by etler 13y ago
"Code happens". In reality, there's code that should have been commented all the time and even in the best codebases. I don't think there's a coder in the world who hasn't had a time when he's looked back on a piece of code and just thought "what?". If you get in the habit of keeping a well documented git history, it's an invaluable resource. I find on top of these benefits, having to explain what changes I made also helps me make smaller and easier to understand commits, which also helps with summarizing releases, finding commits where bugs were fixed or introduced, and so much more. A well documented git history is the closest thing to a time machine you can get.
Should these things happen? No. Do they happen? All the freaking time.
- RyanZAG 13y agoWhat? No, it's got nothing to do with commenting. It's to do with basic code design: put your stuff in functions. A line like that should have been in a function to start with, and it should have been caught during a code review or as common sense by the committer before he even committed.
- etler 13y agoThe point of the article has nothing to do with the code snippet. My point has nothing to do with the code snippet. It's just about code in general, and it's never as easy to understand as you want it to be.
- aidos 13y agoAgreed. Maybe it's in some insane tight loop where you don't want a function call - in which case you comment it. My rule is that if there's something I have to put in the code that's out of the ordinary, I comment to explain.
- stcredzero 13y agobasic code design: put your stuff in function Aye, and with intention revealing names! http://c2.com/cgi/wiki?IntentionRevealingNames http://c2.com/cgi/wiki?IntentionRevealingNames Also: http://c2.com/cgi/wiki?LawOfDemeter http://c2.com/cgi/wiki?LawOfDemeter
- mislav 13y agoThanks for your words of defense, etler. A lot of the criticism of my original post was valid, though, so I addressed it by rephrasing and stressing out that code quality still matters: https://github.com/mislav/mislav.github.com/commit/e07907966bc9e3e46d87346debca8d3d6d1228f1#rdiff-803d102386e332a6f64ffd2fddafdca2 https://github.com/mislav/mislav.github.com/commit/e07907966... You were right, however, that the post was never about code quality or code comments. It was only about "history's great, yo; here's what you can do with it".