Beginner's Guide to Using an IDE Versus a Text Editor

The best tool for Java programmers as they begin writing their first programs is a debatable topic. Their goal has to be learning the basics of the Java language. It's also important that the programming should be fun. Fun for me is writing and running programs with the least amount of hassle. The question then becomes not so much how to learn Java as where. The programs have to be written somewhere and choosing between using a type of text editor or an integrated development environment can determine just how much fun programming can be.

What Is a Text Editor?

There isn't a way to spruce up what a text editor does. It creates and edits files that contain nothing more than plain text. Some won't even offer you a range of fonts or formatting options.

Using a text editor is the most simplistic way to write Java programs. Once the Java code is written it can be compiled and run by using command-line tools in a terminal window.

Example Text Editors: Notepad (Windows), TextEdit (Mac OS X), GEdit (Ubuntu)

What Is a Programming Text Editor?

There are text editors that are made specifically for writing programming languages. I'm calling them programming text editors to highlight the difference, but they are generally known simply as text editors. They still only deal with plain text files but they also have some handy features for programmers:

  • Syntax Highlighting: Colors are assigned to highlight different parts of a Java program. It makes code easier to read and debug. For example, you could set up syntax highlighting so that Java keywords are blue, comments are green, string literals are orange, and so on.
  • Automatic Editing: Java programmers format their programs so that blocks of code are indented together. This indentation can be done automatically by the editor.
  • Compilation and Execution Commands: To save the programmer having to switch from the text editor to a terminal window these editors have the ability to compile and execute Java programs. Therefore, debugging can be done all in one place.

    Example Programming Text Editors: TextPad (Windows), JEdit (Windows, Mac OS X, Ubuntu)

    What Is an IDE?

    IDE stands for Integrated Development Environment. They are powerful tools for programmers that offer all the features of a programming text editor and much more. The idea behind an IDE is to encompass everything a Java programmer could want to do in one application. Theoretically, it should allow them to develop Java programs faster.

    There are so many features an IDE can contain that the following list contains only a selected few. It should highlight how useful they can be to programmers:

    • Automatic Code Completion: Whilst typing in Java code the IDE can help by showing a list of possible options. For example, when using a String object a programmer might want to use one of its methods. As they type, a list of methods they can choose from will appear in a popup menu.
    • Access Databases: To help connect Java applications to databases IDEs can access different databases and query data contained within them.
    • GUI Builder: Graphical user interfaces can be created by dragging and dropping Swing components onto a canvas. The IDE automatically writes the Java code that creates the GUI.
    • Optimization: As Java applications become more complex, speed and efficiency become more important. Profilers built into the IDE can highlight areas where the Java code could be improved.
    • Version Control: Previous versions of source code files can be kept. It's a useful feature because a working version of a Java class can be stored. If in the future it is modified, a new version can be created. If the modifications cause problems the file can be rolled back to the previous working version.

    Example IDEs: Eclipse (Windows, Mac OS X, Ubuntu), NetBeans (Windows, Mac OS X, Ubuntu)

    What Should Beginner Java Programmers Use?

    For a beginner to learn the Java language they don't need all the tools contained within an IDE. In fact, having to learn a complex piece of software can be as daunting as learning a new programming language. At the same time, it's not much fun to continually switch between a text editor and a terminal window in order to compile and run Java programs.

    My best advice tends to favor using NetBeans, under the strict instructions that beginners ignore almost all of its functionality at the beginning.

    Focus purely on how to create a new project and how to run a Java program. The rest of the functionality will become clear when it's needed.

    Look at getting started with NetBeans to learn how to create a new project and run a program.