What is Eclipse IDE

Why develop with Eclipse?

Author:
Kristian Koehler
Orientation in Objects GmbH
Date:July 2002

abstract

This article introduces the Eclipse development environment and shows some of its advantages. In particular, individual features are discussed in the overall context of a professional development process.

motivation

A powerful integrated development environment, or IDE for short, is essential for a professional development environment. However, choosing such a development environment is not easy, as there are quite a few commercial and free solutions on the market. A strategic decision based on "I've heard of it before" or "I've seen this at some point" should definitely be avoided, as should a pure "gut decision".

A "wrong" decision when choosing an adequate IDE can endanger the overall success of a project!

Eclipse

The Eclipse project is an open source project dedicated to the development of a robust and comprehensive development platform that is suitable for commercial use. The basic framework of the project is the Eclipse platform, which is an expandable Java-based IDE. In addition to its own features, it is characterized by a strong integration character, which enables the integration of external tools. The following are the most distinctive features of Eclipse are shown.

architecture

Eclipse is a platform designed from the ground up to create integrated web and application tools. It provides "only" a small scope of services in the form of basic functionality and user navigation. The actual features are provided so-called plug-ins.

This relatively slim design enables the platform to be used for a wide variety of application areas and not just as a development tool. Many manufacturers have switched over to building their own products on the Eclipse platform or developing extensions for them.

The version, which can be freely downloaded from the Eclipse homepage, already contains a large number of useful plugins for the Java development process, which make the platform usable as a professional Java development environment. Various plug-in homepages can be used to add additional extensions such as B. Database connection or download smaller games for in between.

Perspectives

The Eclipse platform "sees" projects in logical views called perspectives. Associated views, editors as well as menu and toolbar entries are defined and linked in a perspective. So there are z. B. a Debugging Perspective, in which all the views needed for debugging, such as B. Debugger output are summarized.

Perspectives are always used for a specific task. Would you like z. B. To edit Java source files, you will use the Java Perspective, if you want to debug applications, you will use the Debug Perspective.

The features contained in the freely available version are briefly presented below.

Powerful editor

A powerful editor is indispensable for a good Java development environment. With the "built-in" Java Editor, Eclipse provides a very extensive and powerful tool. In the following a few features of the editor will be presented.


The Eclipse Editor

Error display

The source text that has just been edited is translated in Eclipse during the saving process and any errors that occur are marked in the source text immediately. In this way, these can be quickly localized and improved. All errors are also shown in an overview table and you can quickly jump to the relevant point.


Error display in the Eclipse editor with lightbulb

Error display in the Eclipse editor (missing try-catch block)

For each marked error, tool tips with the description of the error can be displayed.

Try-catch blocks

Missing try-catch blocks can be easily inserted using the "Surround with try / catch block" option. After marking the corresponding code block, all exceptions that can arise in this block are caught with the respective catch statements.

Example:
out.write (documentStartString, 0, documentStartString.length ()); out.flush ();

becomes

try {out.write (documentStartString, 0, documentStartString.length ()); out.flush (); } catch (IOException e) {}

Organize imports

The import statements can be managed automatically using the "Organize Imports" option. Missing statements are inserted (correctly sorted!), Superfluous ones are removed from the header of the source file. So you always have an overview of the required classes. By default, up to 99 individual import statements are listed until wildcards are used. This behavior can of course be configured.

Quick fix

After double-clicking on an error marker, Eclipse suggests possible ways to correct the error. Is z. If, for example, the handling of an exception is not taken into account in the code, two options are suggested:

  • A statement in the signature method
  • Enclose statement with try / catch

If you have made a mistake in a method name, suitable alternatives are suggested.
Example:
Typed method name
Suggestion from Eclipse: (of course there has to be the method write!)


Suggestion for eliminating errors (quick fix)

Code templates

Nowadays every development environment provides a tag completion option. If a user types the beginning of a statement, possible completions are offered immediately. In Eclipse, normal Java statements as well as JavaDoc comments and your own "code templates" can be inserted. In this way, the editor can be quickly adapted and expanded to suit your own typing habits. These code templates can also be exported as an XML file and imported again for other users.

Of course, in this context Eclipse also offers the option of generating methods for overwriting base class methods and generating getter / setter access methods for attributes.

navigation

In order to be able to find one's way in larger projects as well as in no other projects, extensive navigation options are essential. Eclipse offers very extensive functions here.

With the Java Browsing Perspective you can z. B. jump quickly to any point in the code.


Java Browsing Perspective

Search functionality

In addition to the navigation options, Eclipse offers a very good search functionality that can be initiated via a search dialog. You can search in "normal" text files, auxiliary files or Java source text files. Within the Java files you have the possibility to search for declarations of individual classes or attributes, references to classes or special methods. The results are shown in a list and can therefore be easily accessed.


Eclipse search dialog

Extensive refactoring module

Martin Fowler describes refactorings as changes to the internal structure of software for better understanding and greater maintainability without changing its actual functionality. At first glance, refactorings seem to be superfluous, as they do not add new functionality to the application or expand it However, they serve to increase the readability of the code and thus enable design improvements. In well-readable code, of course, errors can be localized and repaired much better.

With an extensive refactoring module, Eclipse offers a powerful tool for the effective use of refactorings in practice. "Standard refactorings" can easily be carried out with it. So is z. B. the refactoring "move method" is implemented in such a way that the code block to be extracted is marked and the option is selected in a context-sensitive menu. Then you get a preview and you can decide whether and to what extent this refactoring should be carried out or not. Of course, the correct method signatures are suggested for the extracted method.


Preview of the "extract method" refactoring

CVS support

In software projects in which more than one developer is working on a project at the same time, source code version management is necessary. CVS (Concurrent Versions System) is an open source tool that is used successfully in many free and commercial projects.

With Eclipse you get a powerful CVS client that can be used in a professional environment, with which you can very easily check out and edit modules. As already known from the refactoring module, old and new versions can be easily contrasted and compared.


CVS view in Eclipse

Debugger

With the help of a debugger, a program can be stopped at a certain point and the execution of the code can be followed line by line. In some situations the presence of a debugger is useful and an addition to the development process

The Debug Perspective in Eclipse provides extensive debugging functionality and enables a good overview to practice the current state of the virtual machine. A lot more information about the VM can be obtained by evaluating individual statements or checking attributes. Like almost every other IDE, Eclipse naturally also offers the option of remote debugging, which can be particularly helpful for server applications.


Debug Perspective

JUnit support

Tests during software development are an important tool for quality assurance. They can be used to increase the quality of the software and minimize maintenance costs that arise over a longer term or further development time. For these reasons, an IDE should allow easy integration of test tools.

In Eclipse, however, it is not necessary to include your own test tool, as very good support for the free unit test framework JUnit is "included". Test cases can be created using wizards and executed using context-sensitive menus. Test reports are prepared graphically and presented to the user.


JUnit Wizard

Ant support

A solid build environment is a cornerstone of software development. Each project member should be able to build the project on his computer at any time without any problems. In practice it has been shown that tying to tools of individual development environments can prove to be counterproductive, since using them means that a "change of environment" that may become necessary is no longer possible or different platforms cannot be supported at the same time. In the OpenSource movement, the very powerful and freely available build tool Ant has established itself in the Java environment, which is itself based on Java and with the help of which Java sources can be translated platform-independent.

Comprehensive support for this "external" build tool can be found in Eclipse. The individual "construction goals" (tasks) can be selected and executed with the help of a wizard. The messages are output in an overview window and provide information about the current "construction status". The integration of Ant is, like the JUnit support, solved as an "external tool".


Ant integration

External tool integration

Most development processes require external tools. Server applications may have to be started and the developed application deployed. Often the "change to the operating system" is necessary to start an external application. Eclipse offers the possibility to integrate external programs in order to e.g. B. to start or end server processes. But external tools such as JUnit or Ant can also be easily integrated into the development environment.

Written in Java myself

What could be more obvious than implementing a Java development environment in Java?

Java has a widespread reputation for being slow. Eclipse shows that this does not have to be the case. Eclipse is based entirely on Java and, in contrast to many other Java-based development environments, does not use swing classes, but a platform-dependent "Windowing Toolkit" (SWT), which is optimized for the respective platform. The SWT is available for all common platforms and makes applications based on it platform-independent again.

credentials

Eclipse homepage
(http://www.eclipse.org/)

Overview of Eclipse plug-ins
(http://www.eclipseplugincentral.com/)