Often when talking about programming many programmers, especially Linux programmers, say they dont use a IDE, which I find rather disconcerting. After asking them you often hear things like:
- I dont need such fancy things, it distracts from the real programming.
- Im working on Linux, there is a different tool chain from windows, we dont need IDEs we have vim and make.
This itself are valid arguments and I dont think everybody needs an IDE, but everybody needs code completion, if he isnt working on a small project with just a few hundred lines of code. It doesnt matter it the code completion is done by a IDE or by an text editor like vim or emacs. The important thing is that you use code completion, and a good code completion.
What is a good code completion
With good I mean a code completion which knows the following
- which files you are using
- which library you are linking to
- which header to you include
- and so on.
Not a simple one that just knows what you have written in this file and offers you only keywords from this file. Also very important is that the code completion sorts the proposed word using an intelligent algorithm, which takes into consideration what you have written the lines before, often you want to use a variable after defining it but also offers syntax based proposals, like variables if you writing a for-loop and class names if you are inheriting.
The code completion should also be namespace aware and for me the most important point, be always be shown. I dont want to ctrl + space to get a proposal, I want a small pop up window below my cursor which is always there and offers a proposal which is accurate enough that I only need the write 3 or 4 characters before hitting enter and let the code completion to its work.
My favorite code completion systems
Of course what Im describing is the ideal code completion, which wont ever exist, but there are some which are pretty close to my description, for one there is Code::Blocks which has a good code completion, the sorting is often suboptimal and it only works if you have types two or more characters, but besides these point it works pretty good, much bettern then the eclipse c++ code completion.
My favorite is Visual Assist X, a Visual Studio plugin, which does everything almost perfect, but has sometimes problems and wont react at all while waiting for the parsing result, but this happens once a month or so and takes just 30 secs to wait, so nothing really bad. Sometimes its just wrong, especially if templates are involved, but I havent seen a code completion which handles them always correctly. Maybe there are some vim or emacs plugins which do code completion, but I havent found them or found somebody how uses them with all the above described features. Often it is more like a simple code completion.
Use the power
But if you have a really good code completion it fantastic, it just doesnt saves you some typing, it is a form of documentation. Often I dont know what the name of the function is, only some bits, my code completion will help me. I dont have to remember all the parameters and what they are doing, my code completion helps me there to. With a good code completion I dont have to use the documentation of librarys most of the time, only when I need a totally new function. This is even more true when the author of the library used doxygen comments, my code completion shows them to me and this helps a lot. So every programmer how dont want to spend his time looking up functions and parameters should try to get his hands on a good code completion.