Hacker News new | ask | show | jobs
by wakawaka28 249 days ago
This sounds good but if you need it, you probably can and should refactor the code.
1 comments

You know what would be great for refactoring the code? Some way to easily see what parts reference the variable you’re trying to refactor.
Unless you have spaghetti code or have built an abstraction tower, a variable is probably scoped/namespaced neatly. Often, it's just a quick grep to find it. In Emacs, if a variable is only used within a file, you can just `M-x occur` and do the editing there. Where those tools fail, is when you have ecosystems that tries to be clever (JavaScript with its transpilers, Java with its annotations)
Check out 'M-x multi-occur' -- same as 'occur', but scans all of the frame's open buffers. So useful I aliased it to 'M-x mo'
Thanks! So I learned something new about Emacs again. It never ends.

Aliasing something to make it easier to M-x sounds like the next step after running out of letters to use with C-c? I have not reached that point yet, but that was another thing I never considered that could be useful to remember.

> Unless you have

That is a big "unless". We aren't all working on pristine code written to high standards…

Yes, but not everyone uses features like this to make code easier to read. Instead, features like this make less readable code become tractible. The same can be said about autocomplete and documentation popups too. I remember Uncle Bob saying once that his 5 line function limit was facilitated by an editor feature he had that could easily display the code of functions that are called. So it stands to reason that the recommendation should be 25 lines if you don't have such a feature, I think. We don't need to go back to Hungarian notation but certainly using a bunch of fancy features to read the code makes it inherently less readable on the surface level (unless you are very anal and also self-aware and can stick to clean principles).

I'm surprised my comment was downvoted so bad for making an astute observation. It happens to me all the time. A lot of the users of this site suck.

And this comment will most likely be flagged now for whining about getting downvotes.

https://news.ycombinator.com/newsguidelines.html:

"Please don't fulminate. Please don't sneer, including at the rest of the community."

"Please don't comment about the voting on comments. It never does any good, and it makes boring reading."

Lol well where else am I supposed to talk about it? I get irritated about this stuff daily, so I don't really care if my short quips bore a person here or there. Being interesting is what gets me downvoted!
Well, I guess you're not supposed to talk about it haha.

But since it's irritating you I had a quick look at your comment history.

I would say that the downvotes are because a high percentage of your comments are argumentative, and occasionally just flat out insulting. Within that your tone is often condescending and dismissive.

Disagreement alone should not result in downvotes but I guess that's what happens when you do it among jerks lol. As for being condescending, I really like reductio ad absurdum and I think that rubs people wrong. Also somehow, the downvotes seem to pile up the more I reply, as a quirk of how they are calculated...