Mark Lewis
2 min readJan 20, 2022

--

First, I will note that this discussion largely came from a post on novice programmers and I relate a story about a student who spent hours trying to find a bug in JavaScript where he typed fillstyle instead of fillStyle. My original post was to point out that in a compiled language, instead of a dynamically typed one, this would have been fixed quickly by a compile error. But proper auto-complete would have inevitably helped as well. Problem is, you can’t use autocomplete in JavaScript because it is impossible to know what members are in an object until runtime.

One question I have for you is, what editor are you using? I ask because our experience is very different from mine as you’ll see below. For the record, the main editors I’ve used with autocomplete are Eclipse (both Java and Scala) and VS Code (with Metals for Scala). So that is where my experience is coming from.

I’ve never seen #1 where you put in short names like that. That does seem off if you have to remember a different name. #2 I have seen it lots. It happens with new students. It happens any time you move to a different language. It happens any time a language doesn’t have a consistent naming scheme or when you get stuck with a library that doesn’t follow the naming scheme. #3 I’ve had this help. There are times when I know a method exists, but I can’t remember exactly what it is called. Autocomplete can save me a trip to the API for those methods that I don’t use frequently.

I’ll give another aspect here that I find very useful for methods I don’t call much. Good autocomplete, once you have selected the method, lists out all the arguments and their types. This can be very helpful for calls with multiple arguments that you don’t use frequently enough to remember or those with really long argument lists that expect you to use named arguments and you don’t use it enough to remember the names of every single argument.

I agree that autocomplete can be annoying. I really loved the implementation in Eclipse. I find that VS Code is a bit too noisy with popups, but I can live with it. I just hit Esc when I want something to go away. No need to move my hands. Your issue is a pop-up in a comment is something that I’ve never seen. I just tried it in VS Code with Metals to verify that it doesn’t happen. This is really why I asked what tools you are using. It sounds to me that much of your problem is that you have used editors with poor implementations of autocomplete. The one in the comment should NEVER happen in a statically typed language because the thing in the comment doesn’t have a type. That should only happen in a dynamically typed language where the editor is really just guessing and even then only in a poor implementation that isn’t smart enough to recognize comments.

--

--

Mark Lewis
Mark Lewis

Written by Mark Lewis

Computer Science Professor, Planetary Rings Simulator, Scala Zealot

Responses (1)