29

Possible Duplicate:
Should newbies use IDE autocomplete (Intellisense)?

I have a friend at school who wrote a program in VB.net in notepad, took it home fixed any errors that came up, and then compiled it. He used a textbook to get the hang of the relatively basic methods and properties he'd need (nothing complicated like network sockets etc) and then wrote it without looking much up.

This makes me wonder if it is frowned upon to use or rely on autocomplete? In Objective-c the method names are quite descriptive, and mostly I know what I want to do and now roughly the name of the method I want to use, though not necessarily letter for letter.

I could, if I wanted use the Documentation or headers to find method names, and I do sometimes. But naturally this is slower.

So should I focus more on learning parts of the language, than actually programming for a while, or is it ok to use Auto complete a lot?

Also as a subquestion, is better to know one language without much autocomplete needed. or to rely more on autocomplete and be able to use other languages (although not as efficiently and easily) once the syntax is understood.

Jonathan.
  • 880

15 Answers15

38

The tools are there in the IDEs for a reason. As Sean pointed out languages (especially .NET ones) come with extensive class libraries that you cannot hope to remember (despite what interviewers would want you to believe). Would you expect a word processor to come without a spell checker?

With auto-complete you are more productive as you can find the list of available methods/properties/events etc right there in front of you. Otherwise you'd have to either remember (which we've already established is hard) or go and look it up. Both of which take time, thus slowing you down.

You still have to know which of the available methods/properties/events is the correct one to use in the circumstances - no IDE can (yet) write the code for you - that's where your skill as a programmer comes in.

ChrisF
  • 38,948
  • 11
  • 127
  • 168
12

I don't think it's frowned on. These days most languages come with a large expansive class library (or two!) and having to commit the exact name, and sometimes casing, isn't always necessary. Plus, multiple overloads on a method make this even more cumbersome.

At the end of the day you've got to understand what you're calling/doing. Auto-complete won't help here.!

Sean
  • 1,134
10

A few years ago I had to let a programmer on my team go because he insisted on using a text editor rather than the .NET IDE. To be fair, the real reason was that he was slower getting his tasks done and his code was poorer quality and caused integration problems. It's possible that some programmer-savant could have done a better job with just a plain text editor but most of us regular folks need help like auto-complete and speling and grammer checking.

As I like to say, don't bark when you can hire a dog to do it for you.

jfrankcarr
  • 5,082
9

I'm old enough to remember when autocomplete made it into my IDE.

It made me explore much more sourcecode than I ever did before. Because of that, I strongly believe it made me a better programmer.

8

It is wrong if you need it to code. It is perfectly fine if it something that help you to be more productive.

ChrisF
  • 38,948
  • 11
  • 127
  • 168
deadalnix
  • 6,023
4

School is different from the real world. I would only use it at school if it was going to be available during your examinations. In the real world, there's really no reason not to. It's like relying on GPS when you move to a new city. It takes you longer to learn how to get around without it, but you still do eventually, and you get lost a lot less in the meantime.

Karl Bielefeldt
  • 148,830
4

I absolutely wouldn't be without Eclipse's fantastic autocomplete.

  • It helps you navigate your way round obscure APIs (Is it .put(), .add(), or .addElement() to add an item to an ArrayList? What's the order of the parameters to System.arrayCopy() again? Either navigate to the appropriate documentation page, or press Ctrl-Space to view a quick list of all methods available).
  • It slashes down the amount of typing you need to do (System.out.println() vs Sysout+Ctrl-Space)
  • It lets you know instantly if you've made a mistake. If the autocomplete stops working, it's a sure sign you've gone wrong somewhere.

All of these things combine to make for a very productive environment for software engineering.

funkybro
  • 867
3

To offer what seems to be a contrarian view:

Remembering: A language library that is sufficiently "random" that you need auto-complete to help remember which method to choose (e.g. is it size or length?), is broken. Would be better to fix it, than to band-aid it. If you can't fix it, wrap it. (If you don't know what it means to wrap it, learn that.)

Typing: Already know exactly the name you want, and claim you're using auto-complete purely to "save keystrokes"? That seems to make sense, although just typing the name is faster than reaching for cursor keys or gods help you the frakking mouse. (If the name really is that long, see above: Fix it or wrap it.)

Programmers who can't type fast are like kids who want to be NBA players but can't make free throws. It's a basic skill you must have. It can be improved if you care and you aren't too lazy to practice.

Obviously there are many mediocre programmers and ball players. Is being mediocre "wrong", as the question puts it? Maybe not. But my answer is aimed at people who aspire to being more than "not wrong", i.e. to doing more than not-sucking. Which I think was the spirit of the question.

2

I've seen people only being able to code by auto complete and try and error. That's bad because since they don't understand what they do, they can't solve anything beyond toy problems.

In all other cases anything helping you being more productive is a clear win.

1

One method of learning a new language or algorithm is to re-type the example(s) totally from scratch. I find that re-typing an algorithm (even if the example is is cut-n-pasteable) focuses my attention and causes me to question every operator, every function call. Auto-complete in this circumstance would detract from my learning.

To address your question direction: It depends on the circumstance. If you're learning, or you just want to avoid Cargo Cult Programming, then avoid auto-complete.

Bruce Ediger
  • 3,535
1

Remember that a language and a framework are two different things. None of the languages that I can think of have so many syntactic forms that a programmer with a bit of experience should have trouble remembering them.

Modern application frameworks, on the other hand, tend to have dozens or hundreds of classes and thousands of methods. You might be able to memorize all that if you really want to, but it'd be a lot like doing The Knowledge minus the licensing exam.

Don't use your IDE's autocompletion as a crutch -- you should work toward a solid understanding of the classes available and the methods they offer. If you have to pause every time you type NS or UI in Xcode and spend time looking at the list of options, you should spend some time with the docs. But there's nothing wrong with letting the compiler complete names for you if you know basically what you're doing.

Caleb
  • 39,298
1

I see it frowned upon a lot by folks who code in dynamic languages or languages without a sophisticated IDE available. Java or .NET programmers love it. Even for APIs that I'm familiar with, it saves a ton of time so I don't have to remember spelling or argument lists for thousands of methods or keep the javadocs open all day. I've been doing some Python with Eclipse + PyDev recently and it's helpful, but limited. Dynamic languages in general aren't well-suited to autocomplete since methods may not be known at compile time and argument lists may be variable.

jiggy
  • 1,590
1

Autocomplete is good - if you know what you're doing.

Points in favor:

  1. No need to memorize the whole of various libraries.
  2. Easy to see what's available (I use this in Python a lot after importing something, to remind myself what's in the module, if I'm looking for something and uncertain how to use it)

Points against:

  1. You have no need to memorize anything, so you're less likely to try and keep it in your mind.
  2. In some cases, autocomplete can slow you down. Offhand, Eclipse and Java pops into mind - if I know what I'm doing, the autocomplete popups distract me and break the flow.

Neutral points to keep in mind:

  1. If you use a library function often enough, you'll have it memorized just because you see it so often. This can help you memorize the correct spelling because it's pulled up automatically - or it can hinder memorization because you're relying on autocomplete to get it right.
  2. If you don't use it often enough to memorize on its own, there's probably a reason. In that case, best to look at the documentation to make sure you understand the function, and aren't just tossing it in because autocomplete found it.
Izkata
  • 6,118
  • 7
  • 30
  • 44
1

These days I would phrase the question the other way around ´Is it wrong to code without autocomplete?´. If you are using descriptive naming you are very likely to misspell at least some references. A good IDE will suggest a reasonable set of suggestions at any point.

The things we are coding have become extremely complex, and it would be unreasonable to expect programmers to know all of the components they need to reference off the top of their head, and to spell all the references without mistakes. Autocomplete simplifies the task significantly and allows the programmers to concentrate on the complexities of the code.

BillThor
  • 6,310
0

Computers are good at exact string matching (especially in the case of hash-tables) - humans are not. Brains are associative constructions that recall code often using in-combinations of its sub-words and their synonyms and not neccessarily in the correct order. That's why IDEs exist and why there is still room for improvements in this area.

LLVM are taking innovative steps (thanks to Apple's money) in this direction through its IDE-plugin library libclang. libclang supports fuzzy spelling corrections of indentifiers based on the Levenhstein (Edit) Distance.

Nordlöw
  • 151
  • 5