Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple APILearn More
Voxera860729dConsidering the code, are you sure you would like to see what they came up with without the restrictions of the language :P
ars131829dWhen I had the chance to ask the original developer about what lines 500-550 of one of his functions were for, I would often get a "oh you can delete that we don't use it anymore" response.
Fun fun times.
rolexpo11228dCode should be self documenting lol.
0x5d012728d@byshiny Yeah. Though sometimes it doesn't hurt to know an intent behind something. Projects like suckless software are pretty self-explanatory without any comments since they're small and transparent in terms of intentions but I've worked with really shitty code bases a lot of times, and 9 times out of 10 the author didn't bother to explain himself, which turned the workflow into a whack-a-mole in mere minutes.
tl;dr, Self-documenting code is cool and all but it won't work out well when the author can neither write well nor plan ahead of time.
junon101727d@byshiny This only works when the code is logical. If you have e.g. bit-twiddling hacks, you NEED to document next to them what they do, for example. Seeing magic constants being bitwise XORd all over the place will never self-document except for those already accustomed to such algorithms.
So no. You're only sometimes correct.
Further, just because code self-documents how it works does not explain WHY it was included at all. Sometimes, some seemingly superfluous code is actually necessary but you'd never know it at first glance. Adding a comment about why it's there can work wonders and is something the code simply cannot document on its own.
Please stop regurgitating old and aged dogmas without really considering their intent.