开发者

Does Autocomplete Have an Impact on Code?

Empirical question about code: Does the use of autocomplete change one's code? In general, do developers who use autocomplete tend to use longer variable names, for instance, or does it not really change thin开发者_JAVA百科gs in terms of the code written?


I find autocomplete helps me in the following ways:

  1. Autocomplete makes it easier to name things what they should be named, and not what is easy to type. I find myself using more descriptive names for things when I have autocomplete.

  2. Autocomplete also makes me more efficient by freeing me from having to commit to memory large swaths of API. The autocomplete helps jar my memory when I an looking for a particular method or class.

  3. I like to use autocomplete as a form of in-place API exploration. If I know generally what I am looking for, I use the autocomplete to explore what an object does, rather than breaking out of the editor to look something up on google.


I think that auto completes doesn't have impact on code, but auto complete could lead to programming by coincidence, when the programmer try to use one function without seeing the details. And if it works, it's done.

I think that this is one of the collateral effects of auto complete.


One thing autocomplete can do to change your code is to make you aware of functionality inside a given library that you might not have noticed unless you scoured the libraries docs - this could allow for better (more concise) usage of the libraries.


I would say that AutoComplete and Intellisense both encourage the use of longer variable names by visual cues and convenience.

However, just because these features encourage cleaner code writing (i.e. longer variable names) doesn't mean that they are used or welcome by everyone.


I have found that I write longer and more descriptive variable names when I have autocomplete available in an IDE. When I began writing Ruby I started with vim as the editor, and would try to keep variable names below 8 characters or so. When I switched to RubyMine, I no longer worried about variable name length and used much longer names.


Autocomplete is useful for longer variable names but I find it more useful for exploring APIs and such. Also, when it shows the doc hints I find that most useful especially when there are variations on a function/method.

However, I usually refrain for 'excessively' long names because you can't always guarantee that someone else will have autocomplete in their preferred editor. Not to mention occassionally performing edits on a production server (yeah yeah, spare me the lecture) you'll usually be using something like vi if you are on a unix system.

As for really long variable names, I just shorten it but still retain hinting as to what its purpose is. Or if the variable is short-lived (only in a small code block) I'll just use something really short even if its not obvious.


I personally left the longer-variable-names bandwagon years ago. But I still find autocomplete helpful in reducing the number of errors caused by mistpying.

Yes, the compiler will catch this but more and more I find myself using languages without compilers.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜