I've watched many beginning developers learn the bare minimum about their IDE, and then... stop. Just enough to edit, compile, and run. This is not enough. No matter what language you code in, and no matter what IDE you use, you spend a lot of your day using the tool. So it's worth investing the time to learn some advanced features. This time will be repaid in developer productivity many times over.
In this article I'll give examples from the popular Eclipse IDE for Java because I know that one best, but similar time-saving features are found in all modern IDEs. The good folk who write an IDE put a lot of time and energy into sculpting the platform to save you time and mental energy. And time, as a busy developer, is one of your most restricted commodities.
Kitty on the Keys?
Keyboard Shortcuts will save you time by letting you avoid moving the mouse. No big deal you say? It takes several seconds or so each time you move your hand off the keyboard, find the mouse, move your eyes back to the screen as you move the mouse from the editor to the menu, click to open a menu, move the mouse down to a menu item, click again, and move your hands back to the keyboard. You've wasted time and neural energy, neither of which you will ever get back. Your fingers are already on the keyboard if you were just editing the code, so just type CTRL/Shift/O to fix up all the imports, or Alt/Shift/X to run your program. And don't use the File->Save menu item before running, and don't even use CTRL/S to save before running, because all sane IDEs default to saving files automatically before you run them--d'oh!
The immodestly-named Ian's Ruleis strictly enforced here:
Never type more than the first 3 or 4 characters of any name that is known to the IDE.
Type @ T R CTRL/Space and Eclipse will type the @Transactional annotation for you. Typing syso CTRL/Space will get System.out.println() typed out for you. Eclipse calls that latter one a Template. Many useful pre-defined templates come with Eclipse, and you can add your own.
Whenever you use a menu item, look to see if it has a keyboard shortcut. They show on the menu so you can memorize them. Learn one a day and you're well on your way!
The Max Factor?
Refactorings will save you time by performing complex operations for you. You want to rename a public method used by a dozen other classes in your project. You type over the method name where it's defined. But now you have to go into each of those other files (which would show reds as soon as you save the file with the definition), and make the change there. Even if you started by using search and replace on the definition, you'd still have to open all the other files in the editor. Worse, what if the name you're replacing is a substring of another method? What about changing the one but not the other in code comments?
The solution? Refactor->Rename. The IDE knows all the code in all the classes in your project. Select the old name, type CTRL/Shift/R, and type the new name. Boom! You're done, all through the project.
Another example: adding a debug printout of a value that is part of a complex expression. You could do this by hand, but why would you? Select the part you want to see, hit Alt/Shift/L (Extract Local Variable), and pick a name for your new local variable. To print it, use the SYSO Control/Space template. To undo this, select the variable and use Alt/Shift/I to Inline it. Want to pull some code out of one method to make a new method for re-use or for testing? Select the lines of code and do CTRL/Shift/M.
There are many useful refactorings, and they tend to have similar names on different IDEs because of a catalog called Refactorings. I define a refactoring as 'a behavior-preserving change that improves the code'. Refactorings performed by the IDE are far less likely to introduce bugs than the developer who does the same task by hand. So, use the refactorings!
Plug In To The Max
Plugins will save you time by carrying out larger and/or more specialized tasks. Most IDEs today consist of a small engine, with most of the functionality in plugins. In Eclipse, for example, the Java Editor is a plugin, as is almost everything you interact with. A large collection of plugins comes with the full install of the typical IDE. Plugins may display information, or allow you to edit it, or process it in some way. Specialized plugins exist for:
- many programming languages
- editing diagrams such as UML and process flows (in most cases also generating the code that the diagrams represent)
- interacting with bug trackers and continuous integration workflows
- building and packaging various types of applications and for integrating with Maven or Gradle to so the same
- and much more.
As one example, the Maven plugin (M2E) maintains your project's classpath from the Maven build file, eliminating the need to maintain two versions of that list of Jar files. The possibilities of plugins to extend an existing IDE are almost endless. The Eclipse Marketplace Client (under the Help menu) catalogs the vast majority of these and will install any of them with a click or two.
Look ahead to Productivity
Look. You have to spend some time to save some time. But it's worth it. You will benefit every time you write or maintain code. I have a ref card of Eclipse shortcuts on my web site.
Next time your boss is away at a conference, spend an hour exploring these shortcuts, refactorings and plugins. By the time the boss is back, you'll be much more productive. You'll spend less time on grunt work and having more time to focus on algorithms and architecture. And dream about becoming the boss.