3 ms·
Gave myself RSI deleting <600 LOC with vi. On the plus side I replaced an O(n²) algorithm with a faster one in the very next commit. Needed to get rid of the n
by hinkley 3y ago
Gave myself RSI deleting <600 LOC with vi.
On the plus side I replaced an O(n²) algorithm with a faster one in the very next commit. Needed to get rid of the ninety copies of the same bad idiom first.
- hsjsbeebue 3y ago600dd:w shouldn’t cause RSI ;)
- hinkley 3y agoIt was five to six lines of code repeated in half a dozen spots in a dozen files, with different variable names, and different arguments. And I wasn’t deleting them, I was replacing them with the same function call.
- aidos 3y agoThat’s got “macro” written all over it.
- jraph 3y agoThat's a sed /d of course. Or a "Replace all in folder" in any decent code editor. Or a sufficiently efficient "extract to method" on a decent IDE, that notices the different occurrences even with renamed variables. Unless those lines of code were subtly edited all over the place and needed careful and subtly different replace for each occurrence, or at last review because that's what's truly evil with duplicated code. It's forks that diverged to maintain N times in your codebase.
- selcuka 3y ago> Gave myself RSI deleting <600 LOC with vi. Why? Didn't you know the shortcut `d600d`? /s
- mehdix 3y agoI was giving myself RSI by deleting <12000 lines of copied comments (only misleading noise, explaining what was happening) and <4000 LOC (replaced with a 120 LOC in a single fn) when I reverted to using regex while sanitizing a badly bloated codebase. Can feel you right there.
- jpc0 3y ago> when I reverted to using regex Begrudgingly I hope... If you replaced 4000LoC with a regex that regex scares me...
- mehdix 3y agohaha! I did use regex to find and delete repetitive patterns of code with slight variation that would be carried out by the aforementioned function. I wish I could write such a monstrosity though :)
- veidelis 3y agoNot much of an achievement, but I once deleted a 45k line Jest snapshot test for a React component that basically asserted that a div is rendered.
- prettyStandard 3y agoMaybe you are being sarcastic... Or you've completely missed the point of the article/story. The point is lines of code are almost meaningless. In this story the person saved 2k lines of code by rewriting a rendering engine, and use somehow think that's less than deleting a 45 k line jest snapshot.
- stuartd 3y ago“Not much of an achievement, but” here refers to the commenter’s action, not the one in the article
- veidelis 3y agoSorry, if it somehow sounded that my example is somehow more than what was mentioned in the article. Absolutely not. I think that my example also very well demonstrates that lines of code (even that isn't really "code") isn't not a good way of measuring productivity etc. My example could be considered as an example of how a code review didn't "do it's job" for what might have been a newbies mistake. But I also think that code reviewers cannot be blamed for every bad piece of code that gets through (context matters).
- deleted 3y ago[deleted]