As a developer, you’ll spend a lot of your time writing code. Less than you’d think, as we’ll see in future tips in the series, but still thousands of hours.
It pays dividends to master your code editor. A powerful editor, properly used, will provide a myriad of benefits.
Benefits of a code editor
The following incomplete list will give you an idea of some of the ways in which an editor can serve you:
- Speed up the process of writing code by autocompleting parts of the code you write.
- Highlight and indent your code for readability.
- Simplify the process of refactoring code (e.g., consistently change the name of a variable across your program).
- Point out obvious typos.
- Easily find code within your project (e.g., through finders or through the ability to jump to definitions).
- En mass manipulation of text and code, without having to manually perform changes lines per line (e.g., replacing strings, commenting out large sections of code, etc).
- Execute code directly without having to step out of the current window.
- Folding your code, so that you can focus on the current method or class, and ignore the rest of your code base.
- Visually identify files that have changes from your git repo.
Honestly, this isn’t even scratching the surface. Just take my word for it, being well acquainted with your editor of choice will eliminate a world of frustration from your coding experience.
Choosing a programming editor
A natural follow-up question to the previous paragraph would be, “Which programming editor should I use?”. Ask ten programmers and you’ll get at least five different answers. It’s a highly personal choice and people get religious about their editor of choice.
I’m going to share my opinion and you can then find out for yourself what works best for you.
I would divide most editors into five categories:
- Shell-based text editors. These are historic text editors that include such offerings as such as Vi/Vim and Emacs. They are extremely powerful and customizable but come at the expense of a high learning curve.
- WYSIWYG text editors. Examples of this type of text editor are Notepad++, Atom, and Sublime Text. Much less of a learning curve than something like Vim, but still quite powerful.
- Integrated Development Environments (IDE) that are specific to a particular development stack. Some will argue that these are not code editors, but they certainly include one, among a whole host of other features, often including a way to visually design your application. Examples of IDEs are Android Studio, XCode (for iOS and Mac OS X apps), and Visual Studio (for .NET applications).
- Niche specific editors. For example Coda for front end web design.
- Cloud editors that enable you to develop directly from your browser. One example of this sort of editor and development environment is Cloud9.
Any editor will do (well, don’t use Microsoft Word), but the choice will be very dependent on the kind of development you intend to do.
For example, if you plan to develop for the web:
- Learn the basics of Vim or Emacs for when you are remotely shelled into a Linux / BSD server.
- Master Atom or Sublime Text for your main development.
Conversely, if you plan to develop mobile apps:
- Learn the basics of Atom or Sublime Text for incidental file editing.
- Master your app platform IDE (e.g., Android Studio, XCode, Xamarin).
In general, I would recommend that you learn the basics of Vim so that you can quickly change files when connected to a remote server via the shell.
Vim or one of its variants is almost always installed on Linux/Unix servers already or can be easily installed if you have admin rights.
If you love it enough to master it, you might even want to stick with it as your main code editor. Many developers do.
Regardless of what you choose or do, spend the time to become proficient in the tool you decide to use to edit your code (including reading a book on the subject if your editor or IDE is quite advanced).