Dave Collier-Brown via talk wrote: > On 2019-11-08 11:41 a.m., Giles Orr via talk wrote: > > Eyeballing simple regex is hard enough, but mentally parsing out a > > complex full line regex that looks like inline garbage without the > > benefit of comments isn't something I recommend or appreciate. > > An early boss described it as "programming in line noise".
I've seen too many cases where the comments explaining what a block of code did were *wrong*, and debugging took far too long due to coders reading, trusting, or simply being distracted by this alternate theory of what the code was doing. Being able to read the code itself and figure out what it's doing is a primary programmer skill, and writing code that's not harder to figure out than it needs to be is important too. With regexen for eg matching logfile lines, a comment with a few different example lines that should match can be very helpful. Some explanation of *why* you're going to the trouble of doing something, or a simple explanation of what task a block of code encapsulates, are useful things for a comment block. But line-by-line attempts at translating code to English are counterproductive. -- Anthony de Boer --- Post to this mailing list firstname.lastname@example.org Unsubscribe from this mailing list https://gtalug.org/mailman/listinfo/talk