15 ms·
I love JavaScript. I program in it everyday. This is a great list of useful tools. That being said, I disagree with the main premise. The tooling is getting th
by ryanackley 11y ago
I love JavaScript. I program in it everyday. This is a great list of useful tools.
That being said, I disagree with the main premise. The tooling is getting there but it's just not as good as old-school IDE's for typed languages. Specifically, the code insight tools don't really compare. For example: Intellisense, refactoring, go to definition of a symbol, and find symbol references.
I programmed in typed languages for many years and when I find myself back in an old-school IDE for a typed language like Eclipse or Visual Studio a cognitive load is lifted off my shoulders.
- stephenr 11y agoI don't really write much JS these days, but JetBrains IDE's (IDEA, PHPStorm, WebStorm) are able to provide pretty good code intel (and do refactoring) for e.g. PHP using DocBlocks (or of course language type hints/return types now) - I'd imagine the same is true of JS using JSDoc DocBlocks, no? I know for front-end, and also a reasonable number of back-end web developers in scripting languages lightweight editors like Sublime, Atom etc are popular these days.. maybe that's driven the idea that "scripting/untyped/loose typed languages can't have good Code Intelligence"?
- inglor 11y agoThis. I love the look of awe sublime people have when I open webstorm - perform a "go to definition" and it just works. It's amazing how many capabilities people miss on.
- Lio 11y agoI guess it depends on the code base you're working on. My main experience of using webstorm was on a client's legacy code base. Their policy was that webstorm had to used over any other tool. None of the clever feature like go to definition worked properly and it ended up just dropping back to grepping for symbols project wide. Personally I couldn't see any features you couldn't get from using TernJS and ctags with a quality editor. I found it a bit slow and the keyboard navigation to be about limited. (Not in the main editor so much but in little things like navigating window splits, manipulating pairs, etc)
- awalGarg 11y agoSublime Text can do "go to definition" just fine, out of the box. F12 is the key you are looking for.
- inglor 11y agoOnly if you're on the same file, in large projects in the best case scenario it becomes stuck for 15 seconds, usually it just doesn't work.
- kristopolous 11y agoCtags is older than dirt and does this fine.
- spdionis 11y agoWebstorm capabilities were still very weak compared to Phpstorm last time I tried. My gf works in js with webstorm and was amazed by what I whas doing in php. That said php is much more static than js.
- kyriakos 11y agoBeen using PHPStorm for years and still when I hit find declaration key combination I'm still not sure if it will actually find it or tell me it can't. I came to accept this as a limitation of using a dynamic language. On the other hand I'm sometimes surprised by the things it can figure out from my code.
- spdionis 11y agoIt always finds it for me, but surely mostly because my project is structured in an appropriate way
- kyriakos 11y agounfortunately some of us have to use... wordpress... :(
- spdionis 11y agothere's no integration? I have awesome integration wih symfony.
- kyriakos 11y agoWith wordpress in order to add a hook when building a plugin you need to specify the class name and method to call in an array with 2 elements. PHPStorm can't really peer into it. Then I also use Laravel's Eloquent outside Laravel, models don't get auto complete in that case either. e.g. if you do a $user = User::find(1); PHPStorm doesn't understand that $user is an instance of User class unless you explicitly tell it. Apparently if you use the whole Laravel framework there is a CLI utility that adds annotations to you and fixes this issue.
- peeters 11y agoI use IDEA for Java and JS, and the JS intelligence is nothing compared to the Java intelligence. I would never rely on the refactoring tool to do an operation in Javascript. It simply can't do much past grepping and guessing. In Java, I don't think twice about renaming a method, e.g.
- nqzero 11y agoif a js codebase is structured appropriately, webstorm does an excellent job of intellisense and refactoring. netbeans 7.2 does an adequate job, but oracle ruined the js support when they bought sun (didn't like the rhino license - they've been pedaling backwards ever since) the biggest issue i see, is that the "dialect" that you need to follow to enable the intellisense isn't well-defined. what seems to work for me: 1. explicitly define constructors 2. explicitly define the prototype 3. use jsdocs if you're using inheritance 4. initialize object literals (even if they get overwritten immediately)
- mateuszf 11y agoYes, JetBrains IDE's for dynamically typed languages are pretty nice, but what they allow is still nothing compared what Intellij IDEA does for Java. And I'm saying this as a fan of Clojure which is not statically typed.
- stephenr 11y agoCan you give an example of an IDE feature in eg Java that isn't incorporated for a language like say PHP?
- mateuszf 11y ago100% right code completion, call hierarchy, navigations, accurate safe refactorings. True, it is possible to use reflection (kind of metaprogramming) to call a method in Java too, but it's done sporadically because of various reasons. It's not just a matter of additional features, but rather a matter of being sure that they will just work without thinking about edge cases.
- stephenr 11y agoI don't know how the IDEA/etc code completion for Java/etc works, but for PHP it works from stub files (i.e. they have an engine that can build completion info from actual PHP files, and then they create stubs of the builtin classes/functions) so it works well (and you get the exact same level of support for included libraries or project src) except for one repeating issue: There is apparently less effort spent making sure those stubs are really accurate. Does anyone (do JetBrains staff read HN?) know what process they use to generate the stubs?
- Roboprog 11y agoJetBrains has done a good job keeping up with plugins for all the crazy XML sub-languages that programming in Java REALLY means.
- zachrose 11y ago> maybe that's driven the idea that "scripting/untyped/loose typed languages can't have good Code Intelligence"? One idea I've had on this subject is that each layer of tooling multiplies or reshapes the capabilities of all the other layers. This sounds great, but there are good reasons to choose limited tools. Sometimes a powerful tool can grow so powerful that it does the work of other tools, and suddenly your other tools are dependent on this one layer. So we use vim to edit 10 KLOC files, but should your files be that big? Your editor can do braces and semicolons for you, but should you need those? If I have a fancy type system do I need tests? I'm not specifically advocating for a crappy editor, but the rule of least power suggests that we might get ultimate flexibility out of weaker tools.
- stephenr 11y agoI've heard a similar argument used to advocate vim/emacs over a desktop IDE so "I can work anywhere, even on the server" Honestly I don't buy this. Nobody sufficiently experienced to need the power of vim/emacs should also be so comfortable with live editing on a server that it drives their choice of editor. I've used simple text editors and semi-intelligent editors that have basic code intelligence from a prebuilt library and honestly i wouldn't go back to either of them. The advantages of a good IDE are enough to make me overlook that it runs on Java of all things.
- DCoder 11y agoThe code insight is one of the many reasons I switched from plain JavaScript to TypeScript and will not go back.
- sangnoir 11y ago>Intellisense, refactoring, go to definition of a symbol, and find symbol references. VS Code provides all of this (at least for Angular, which I use it for). I think JetBrains supports those actions as well (WebStorm)
- netheril96 11y agoNone of those things work very well in VS Code for vanilla JS, especially when including third party libraries without a d.ts file. Many variables are simply inferred as type `any`, and no intellisense works on `any` types. In contrast, WebStorm will make a guess, which may be wrong sometimes but certainly more helpful than no intellisense, no refactoring, and no go to definition.
- savanaly 11y ago>I programmed in typed languages for many years and when I find myself back in an old-school IDE for a typed language like Eclipse or Visual Studio a cognitive load is lifted off my shoulders. Are you sure this is true for everyone? I learned programming through Java, doing about 6 months of it in an IDE. But I have now been programming in pretty much pure JS with no ide (just vim) for a much longer time and I feel a big cognitive burden when I go back to heavy IDE's. I think our minds change over time and become used to whatever we're programming in.
- eveningcoffee 11y agoFor reference: how big are your projects?
- savanaly 11y agoGithub reports 430 JS files in it, including .spec files. Fairly big, but not gigantic in other words.
- ericelliott 11y agoYou're right, but... These features are available for JS using add-on features such as JSDoc, TernJS, etc... but you're right. Cross-file, these tools don't work as well as they do for Java. BUT. If you need super-advanced cross-file refactor capabilities, chances are you're not using modern best practices for JS application design, including small modules with simple APIs & the open/closed principle (try to make APIs open for new features, but closed to breaking changes). Using small modules generally means that you don't write one large monolithic app. Instead, your app is broken into smaller self-contained pieces that are independently usable and independently testable. Doing so dramatically reduces the need for the kinds of refactors that are harder to do in JavaScript than in statically typed languages. There are also lots of advantages to languages such as JavaScript that allow for type inference without annotations littered all over your code. Annotations come with a cost, and JS provides many benefits that are not available in languages like Java. As I said in the article, the JS runtime tooling makes intellisense look like a baby chew-toy.