Hacker News new | ask | show | jobs
by rubenfiszel 3214 days ago
There is some benefits to not have automatic imports is that it incentivize to keep everything tidy under package object such that you only need a few meaningful imports. It is easy to notice automatic import because the header is an import hell.

But sublime, emacs and vim all support autocompletion (through ensime) so it is not really an advantage of intellij or netbeans.

4 comments

Those are only "benefits" if you don't have automatic imports, though. In an IDE the neatness of your imports is a non-factor in deciding package structure, and who cares about the size or structure of your import block? You never need to look at it and your IDE probably folds up that block anyway.

I was a vim purist for a long time, but even in Python, where IDE functionality is much more limited, I can't honestly compare the two experiences and say I'm not much more productive in PyCharm w/vim plugin. I can't fathom how anyone writes Java/Scala in plain vim, and Ensime is a cumbersome mess.

Speaking re. python:

IDEA also sorts imports alphabetically, separates system modules from non-system modules and removes the names that are no longer used if configured properly. How much time does someone spend doing this by hand (e.g. just simply reading through the list of them)?

IDEA also allows to automatically make the code PIP8-ready by using Ctrl+Shift+L.

I can refactor the name of the function with a basic shortcut, and I am 100% sure, even if it touches >5 projects at the same time - IDEA will replace them correctly. That could be done by a simple find-and-replace, but then I would need to keep my attention on whether that was a correct replacement. How many minutes a day do you spend trying to keep yourself aware of that?

There are literally so many details in working with moderately-complex Python code (e.g. type hints or lack of them; function arguments; unresolved names) that IDEA basically equals to a constant number of hours I save every day.

I am not going to argue - most of what I mention could be solved by automated cli-based tools; and that's exactly what IDEA does under the hood. By it keeps it all together in one place on my screen right now; here, rather than in a set of disjoint interfaces.

I literally do not get why people still use vim/sublime/notepad++. That's like cooking with a blunt knife. You may and will cook as good. But is it not justifying your laziness to go out and buy a proper knife?

I find Java unusable w/o an IDE. However there certainly are languages that are easier to work with w/o one. Go being one example. Depends on design and available tooling. OT: For automatic imports (and formatting) run `goimports` or configure to run automatically on file save. Congratulations, here's also your error stack traces. (EDIT: I mean syntax errors) An IDE, in that case, isn't at all an obvious improvement. Quite to the contrary I find.
Well, I dunno; writing Elm means I get a compiler warning about unused imports, which a lot of compilers can do. Automatic handling of imports coupled with easy pruning of unused ones seems like a complete win to me, what's the downside?
You can configure IDEA to import only the things you absolutely need to import. So I don't know what you mean.
One practical effect I've seen with this in Scala is that IDE users seem to be more averse to typeclasses and other implicit heavy stuff. These things can't be autoimported so you have to do it manually. People who don't use IDEs are used to importing things by hand anyways
reasonable given one should be averse to them even with all the IDE aids (at least in the sense to be judicious when using them). the scala plugin simply cannot handle many parts of the language anyway
If typeclasses are well-designed, they can be auto-imported. Sadly, it's not a common design in practice.