News for hackers. Stuff that matters.
Re:Switching from Vim to Intellij by Scarbutt on Thursday November 05, 2020 @10:35AM (#24999110)
Refactoring tools do more harm than good and they exist to duct tape the complexity path some programming languages set you on by adding more complexity.
Re:Switching from Vim to Intellij by dagmx on Thursday November 05, 2020 @10:40AM (#24999155)
That's... an interesting take. I'm not sure it's well founded, could you expand on your thought?

The refactoring tools in JetBrains products are amazing for me. Renaming a variable and having all uses within scopes renamed too is great. Renaming classes by patterns is also great. Being able to move definitions to new files and have it update all my imports etc is great.

Not sure I see any downsides to optional tools

Re:Switching from Vim to Intellij by dcolkitt on Thursday November 05, 2020 @03:25PM (#25001617)
I mean, Java is pretty notorious for sprawling names like INetworkSessionManagerFactorySidecarControllerFactoryHelper. It's pretty hard to argue that that phenomenon isn't driven by the ubiquity of IDEs in the Java community.

With high-powered auto-completion and one-button refactoring, your brain stops processing the full name. No one's incentive to pause for a minute and come up with thoughtful variable names. For most developers it's too mentally tempting to just puke out some CamelCase word salad, because the IDE hides all the effort of having to read/write/remember unfortunate names.

Re:Switching from Vim to Intellij by indecisive_user on Thursday November 05, 2020 @03:44PM (#25001767)
That's a valid complaint, but at the same time it's not always easy to come up with a good name from the start. I often find myself putting in placeholder names for variables/functions because I'm really not sure what it's going to encompass by the time everything is finished. IDE refactoring makes it easy to clean up names after spending some time with the feature and better understanding what the scope of each function is going to be.

It's great to pause and come up with meaningful names and I agree more developers should do it, but refactoring is a normal part of coding and I'd rather have an easy way of renaming things as the code evolves.

Re:Switching from Vim to Intellij by EdwardDiego on Thursday November 05, 2020 @07:57PM (#25003801)
Sure IDEA is primarily aimed at the JVM market, but I use IDEA's refactorings in Python, Go, Bash etc.

And I'm unsure about your point about meaningful names - IDEA typically won't suggest a name when renaming an existing language artifact - type, class, object, method, function etc.

It will when extracting an expression into a variable, based on the context it was derived from, and that's actually a pretty good heuristic - e.g., if the expression being extracted is

    <some_var> = dependency.get_campaign_results()
It'll suggest things like

    campaign_results
    campaigns
    results
Most of which are what a developer would usually use in that situation.
Re:Switching from Vim to Intellij by pvorb on Thursday November 05, 2020 @04:30PM (#25002199)
Somebody who is too lazy to choose a good variable name in IntelliJ would also have chosen a bad (or even worse) variable name without the tooling. I don't buy that argument.

For class names it might be true that long compound names are driven by auto suggestions from the IDE. But I'm wondering if they're really as bad as their reputation. Somehow it's similar as for variables. You can still come up with more meaningful names if you want but I admit that auto suggestions do more harm there.

Re:Switching from Vim to Intellij by Roboprog on Thursday November 05, 2020 @05:23PM (#25002743)
I think the parent post was attributing longFuglyCapsUnpronouncabeName type identifiers to the Java language/culture, As much as (just) the editor?

I’m biased, though. I HATE gigantic supposedly “self documenting” (but utterly impossible to actually say aloud) identifiers.

My ideal identifiers are 2, maybe 3, syllables, with dashes or underscores, with actual documentation of WHY anything visible beyond The scope of a single function is used.

Re:Switching from Vim to Intellij by pvorb on Friday November 06, 2020 @03:04AM (#25005918)
I guess any piece of code will have someone who finds it horrifying. I prefer long, self documenting identifiers over short (often misleading) ones any time.
Re:Switching from Vim to Intellij by drtz on Thursday November 05, 2020 @10:45AM (#24999198)
I'm not aware of any languages so simple that renaming an identifier and its usages isn't a useful feature.
Re:Switching from Vim to Intellij by jolmg on Thursday November 05, 2020 @04:30PM (#25002200)
How often do people rename identifiers for that to be a particularly useful feature? If it's not that often, you might be served fine with something like

  sed -i 's/foo/bar/g' **.rb
It's not precise, so it might take some manual work and tweaking with the patterns, but for how often I've had to rename identifiers, it works good enough to handle the bulk work.

A bit of forethought when first naming things works wonders, too.

Re:Switching from Vim to Intellij by haxney on Friday November 06, 2020 @04:17AM (#25006257)
That only works if the identifier name is unique across your files. What if you have a field on class "Zoo" named "containers" and you want to replace it with "animal_containers", but only for the "Zoo" class? There are probably other usages of "containers" in the code, with no easy way for something like sed to distinguish between "zoo_instance.containers" and "car_instance.containers".

You need an editor that can understand "this usage of 'containers' refers only to class 'Zoo', so I should find all variables of type 'Zoo' which reference the 'containers' field and change those."

Re:Switching from Vim to Intellij by jolmg on Friday November 06, 2020 @11:50AM (#25009018)
> That only works if the identifier name is unique across your files

hence

> It's not precise, so it might take some manual work and tweaking with the patterns

and like I said,

> for how often I've had to rename identifiers, it works good enough to handle the bulk work.

so

> You need an editor that can understand

No I don't, because renaming across many files is rare enough that I don't need it.

Most of the time, I do refactoring before it's gotten out of hand and so regular vim features like I mentioned in another comment are typically enough.

In other words, I think such understanding by the editor is too much complexity (and language-constrained, at that) for little reward.

Re:Switching from Vim to Intellij by gerash on Friday November 06, 2020 @03:13AM (#25005952)
Refactoring is an essential part of software development. sed is not gonna cut it. The same way that inserting a newline character every 80 or so characters cannot be called source code formatting
Re:Switching from Vim to Intellij by jolmg on Friday November 06, 2020 @11:55AM (#25009055)
Refactoring doesn't consist only of renaming identifiers, and for the portion that it does, regular vim features like `/`, `c`, `n`, and `.` or macros or such are often enough.