Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



I 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.


> when I reverted to using regex

Begrudgingly I hope...

If you replaced 4000LoC with a regex that regex scares me...


haha! 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 :)


Not 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.


Maybe 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.


Sorry, 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).


“Not much of an achievement, but” here refers to the commenter’s action, not the one in the article


600dd:w shouldn’t cause RSI ;)


It 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.


That’s got “macro” written all over it.


That'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.


> Gave myself RSI deleting <600 LOC with vi.

Why? Didn't you know the shortcut `d600d`? /s




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: