Chapter 1. A Java IDE and So Much More!

Looking at Eclipse is similar to looking at a well-cut diamond. What you see depends on the angle of your view and on how deeply you gaze into the interior. To some viewers Eclipse is a Java IDE with the usual features one expects from such an environment: editor, debugger, and project builder with a wide array of preference customizations. To others Eclipse is a generic framework for tool integration providing an extensive, flexible plug-in API. The www.eclipse.org home page declares that “Eclipse is a kind of universal tool platform—an open extensible IDE for anything and nothing in particular.”

Both perspectives are valid interpretations. As the Eclipse community continues its rapid expansion, other users will see it as a modeling tool, a business rules management application, a business process designer, a development environment for embedded systems written in C++, or an HTML authoring and document management environment. Using the Rich Client Platform (RCP) configuration, Eclipse is the basis for any end-user client application.

Many books have been and will be written to describe each facet of the Eclipse diamond. This book focuses on Eclipse as an integrated development environment for building Java applications. Those applications may be other open source utilities, large enterprise systems, or new plug-ins for Eclipse. This book is equally applicable to each of those project teams and individuals.

Eclipse is developed by and for teams using a modern, agile development process. Eclipse is developed using Eclipse in a large, distributed team and with an iterative approach that rebuilds and tests the entire project every night. As a result, Eclipse is well suited to any project using these methods. This book describes several best practices common to agile development teams and explains in detail how Eclipse assists you in those tasks.

In this chapter, we'll view these facets of Eclipse:

  • Building blocks of the Eclipse platform architecture.

  • Development components provided by other Eclipse projects.

  • Alignment of Eclipse with the principles of agile development.

Eclipse Platform Architecture

Given the wide-ranging interpretations of Eclipse, it is difficult to present a quick summary of its architecture. The most general description is an abstract view of the development and runtime environment for creating and deploying plug-in contributions. Alternatively, we can take a functional view that describes Eclipse as a flexible, extensible integrated development environment (IDE). We'll take the latter viewpoint and focus our attention on how Eclipse provides an unparalleled opportunity to improve productivity of software development work.

The Eclipse IDE is as follows:

  • Multi-platform. The target operating systems of Eclipse 3.0 are Windows, Linux (motif and GTK), Solaris, AIX, HP-UX, and Mac OSX.

  • Multi-language. Eclipse is developed using the Java language, but it supports writing applications in Java, C/C++, and Cobol; additional language support is being developed for Python, Perl, PHP, and others. Plug-in contributions to Eclipse must be written in Java.

  • Multi-role. In addition to programming activities, Eclipse supports modeling, testing, Web authoring, and many other roles.

The functional building blocks of the Eclipse IDE are illustrated in Figure 1-1. Each block added to the structure builds on the foundation of those below it. It's this modular nature of the Eclipse platform that has led to its unprecedented growth. The entire platform is open source and royalty-free for other open source or commercial products that add new building blocks.

Functional building blocks of the Eclipse development environment.

Figure 1-1. Functional building blocks of the Eclipse development environment.

The shaded blocks represent this book's focus. However, along the way we'll review other contributed plug-ins that enhance the platform's capabilities for specialized tasks. Examples are unit-testing frameworks for Web-based applications, static code analysis tools, and a style checker that ensures consistent use of coding standards.

The next several sections introduce each of the building blocks shown in Figure 1-1.

Eclipse Runtime Platform

The core runtime platform provides the most basic level of services:

  • Plug-in registry. Loading plug-ins and managing a registry of available plug-ins.

  • Resources. Managing a platform-independent view of operating system files and folders, including linked resource locations.

  • UI components. The Eclipse user interface components are based on SWT and JFace libraries.

  • Update facility. Eclipse applications have built-in support for installing and updating plug-ins from URL addressable locations, including remote Internet sites.

  • Help facility. A common help facility is shared by all plug-ins.

The Eclipse model for platform-independent resources is an important foundation for representing projects, folders, and files in an IDE; we review this in Chapter 3, “Managing Your Projects.” The update facility assists you in customizing your IDE with new plug-in contributions; we review it in Chapter 9, “Updating the Eclipse IDE.”

All of these basic services are implemented as plug-ins on a very small kernel. The Eclipse design makes everything a plug-in. The intent was to treat all developers (and all plug-ins) the same. This ensures that the facilities are both sufficient for the platform itself and for any clients.

Integrated Development Environment

The Eclipse IDE provides a common user experience across multi-language and multi-role development activities. Other contributed plug-ins that build on this IDE foundation don't need to reinvent the wheel.

The most significant IDE features are as follows:

  • Shared views. Many Eclipse features share the use of common views for displaying and editing properties, for listing syntax problems found in the code, and for listing work tasks.

  • Perspectives. A perspective collects a related group of views in a layout suited to particular tasks, such as Java development, debugging, and version control.

  • Preferences. A centralized dialog gathers preference setting pages for all plug-ins installed in the workbench.

  • Search engine. The platform search engine provides general capabilities for searching resources and presenting results. This facility can be extended with resource-specific search criteria, e.g., for Java, C++, or UML model resources.

  • Debugging. Defines a language-independent debug model and UI classes for building debuggers and launchers.

  • Ant project build files. Ant provides general-purpose, flexible build services that can be extended with specialized tasks. The IDE includes an Ant editor and runtime configuration.

  • Team-oriented. Eclipse provides a generic API for integration with version control repositories. Complete support for CVS is included, and plug-ins are available for other vendors' repositories.

In Chapter 4, “Customizing Your Workbench,” we'll study the use of Eclipse perspectives, views, and preferences. The debugger is covered in Chapter 7, “Debugging Your Code,” and Ant build files are used in Chapter 12, “Continuous Integration with Ant.” The team-oriented capabilities are covered in Chapter 13, “Team Ownership with CVS.”

There are additional Eclipse IDE features that are not provided in a generic way by the platform, but users have learned to expect the following capabilities in editors:

  • Synchronized editor and outline. An outline displays a hierarchical list of constructs in the file being edited. Select an outline item to position the editor at the corresponding location.

  • Content Assist. The editor suggests appropriate content to be inserted at the cursor location when the Ctrl+Space key combination is pressed.

  • Templates. Code or other text patterns (such as a Java for loop or an HTML table) are defined in templates that are inserted into a file as part of Content Assist.

  • Formatter. Syntactic formatting rules are defined and customized in preference settings and are applied to editor selections or entire files.

  • Problems identified on-the-fly. Errors or warnings are identified while typing in the editor and are highlighted by icons and messages in the ruler at the editor left margin.

We'll use these features while studying the Java editor in Chapter 5, “Rapid Development,” and then we'll see them again while using the Ant build file editor in Chapter 12.

Java Development Tools

Java Development Tools (JDT) are the only programming language plug-ins included with the Eclipse SDK. However, other language tools are available or under development by Eclipse subprojects and plug-in contributors. The Eclipse Java development perspective is shown in Figure 1-2.

Eclipse Java development perspective.

Figure 1-2. Eclipse Java development perspective.

Fundamental capabilities provided by the Java tools include the following:

  • Editor, outline, Content Assist, templates, and formatting. These general editor features are provided for Java source files.

  • Java views. Several views are provided for navigating and managing Java projects. The Package Explorer view is the cornerstone of the Java perspective, and a specialized Java Browsing perspective assists developers in understanding and navigating large, multi-project applications.

  • Project Configuration. Extensive support is included for configuring Java project classpaths, dependencies, libraries, compiler options, and many other characteristics.

  • Debugger. A rich debugging environment is provided by the Java tools. You can set breakpoints, step through execution, inspect and set variable values, and change method code during debugging.

We cover Java project configuration in Chapter 6, “Java Project Configuration,” and debugging in Chapter 7. The Java tools devote special attention to supporting agile development techniques. Section 1.3, “Agile Development with Eclipse,” introduces this topic with more detail, and Part 2 of this book, “Getting Agile,” is dedicated to studying agile development in Eclipse.

C/C++ Development Tools

The C/C++ Development Tools (CDT) project is creating a fully functional C and C++ IDE for the Eclipse platform. The current focus is on developing and deploying on Linux, but this project's leaders are interested in participation from contributors who would like to extend the work in other directions. For example, targeting Windows, Unix, or embedded platforms and providing wizards that assist development with particular library, database, or messaging APIs.

The CDT 2.0 release includes the following:

  • C/C++ editor. The generic platform text editor is specialized with C/C++ syntax coloring, Content Assist, and formatting.

  • C/C++ debugger. A default debugger implementation is provided using GDB.

  • C/C++ program launcher. Similar to launching Java programs with optional debugging, CDT provides support for launching C/C++ programs.

  • C/C++ parser and syntax API. The parser is an essential foundation for other plug-in contributions that extend CDT.

  • Search engine. General platform search facilities are specialized with C/C++ syntax options that accurately locate code definitions and references.

  • Makefile generator. Similar to the use of Ant in Java development, makefiles are ubiquitous in development of C/C++ projects.

Details and downloads are available on the CDT Web site, www.eclipse.org/cdt/.

Plug-in Development Environment

The Plug-in Development Environment (PDE) supplies tools that automate the creation, manipulation, debugging, and deploying of plug-ins. The PDE is part of the Eclipse SDK and is not a separately launched tool. In line with the general Eclipse platform philosophy, the PDE provides a wide variety of platform contributions (e.g., views, editors, wizards, launchers, etc.) that blend transparently with the rest of the Eclipse workbench and assist the developer in every stage of plug-in development while working inside the Eclipse workbench.

  • PDE perspective. A specialized perspective includes views and shortcuts to commands used most frequently during plug-in development.

  • Host Versus Runtime workbench. The workbench that you are running as you develop your plug-in is the host workbench. After you are happy with your plug-in and want to test it, you can launch another workbench—the runtime workbench. This will utilize the same plug-ins as the host workbench, but it will also run the plug-ins you were working on in the host workbench.

  • Debugging plug-ins. The Java debugger enables complete control while testing plug-ins in the runtime workbench.

  • Packaging plug-ins. Tools for packaging plug-ins and features for distribution to users via an update site are provided.

This book does not address plug-in development specifically, but all Eclipse capabilities described here are applicable to the PDE. Other books in this series describe patterns for plug-in development (Gamma and Beck, 2004) and cover the details of building commercial-quality plug-ins (Clayberg and Rubel, 2004).

Web Tools Platform

The Web Tools Platform (WTP) project was formally approved by the Eclipse Board in June 2004 and received initial open source code contributions from IBM and Object Web. At the time this book was written, those contributions were being reviewed and assimilated into the first milestone integration build. This project is of great importance to the Eclipse community and is likely of interest to most readers of this book. It is still in a formative stage; nonetheless, here we review the project's charter and summarize its expected integration into the Eclipse IDE.

The mission of the Web Tools Platform project is to provide a generic, extensible, and standards-based tool platform that builds on the Eclipse platform and other core Eclipse technologies. The project will deliver a common foundation of frameworks and services upon which software providers can create specialized, differentiated offerings for J2EE and Web-centric application development. Key objectives are to enable product innovation with adherence to vendor-neutral standards and technologies while delivering practical solutions to real development concerns.

The WTP project is composed of two parts. The Web Standard Tools subproject will provide a common infrastructure targeting Web-enabled applications. This includes tools for developing three-tier applications (presentation, business, and data logic) and publishing the resulting system artifacts to servers.

Tools provided by this subproject will include the following:

  • Standard languages. Support will be provided for HTML/XHMTL, XML, XML Schema, Web Services, XQueries, SQL, and other languages used by Web-centric applications.

  • Editors. Editors will be provided for supported languages, including consistent features for outlines, Content Assist, templates, and formatting.

  • Validators. Languages based on XML will be validated against associated schemas and other semantics from the specifications.

  • Server publication. The workbench will provide commands and views for starting, stopping, publishing, and running applications on multiple target servers.

The J2EE Standard Tools subproject will provide common infrastructure for developing applications based on J2EE 1.4 specifications targeting J2EE-compliant application servers. Deliverables include generic J2EE tools for other Eclipse-based projects and products, and IDE workbench plug-ins that support developing, deploying, testing, and debugging J2EE applications on JCP-compliant servers. The J2EE workbench will support use cases such as developing a JSP page, enhancing the “Pet Store” blueprint application, and exposing an EJB session bean as a Web Service.

Tools provided by this subproject will include the following:

  • J2EE artifacts. Tools will support EJB, Servlet, JSP, JCA, JDBC, JTA, JMS, JMX, JNDI, and Web Services.

  • JSP editor. The editor will support mixed HTML and JSP tags, including JSP tag libraries, plus outline, Content Assist, templates, and formatting.

  • JSP refactoring. Java refactoring (e.g., renaming a class, method, or package) will find and refactor dependencies within JSP pages.

  • Search facilities. Search criteria are aware of syntax for JSP, XML, and other document types. For example, searching for a method name includes cases where that name is used as a method, but not when used in other text strings.

  • Comparison of syntax. Comparing two JSP or XML files considers syntax while identifying logical code constructs, such as when viewing differences between two versions of a JSP file in a repository.

Details and downloads are available on the Web Tools project Web site, www.eclipse.org/webtools/.

Rich Client Platform

The Eclipse Rich Client Platform (RCP) is more notable for what it doesn't have than for what it has. Although the Eclipse platform is designed to serve as an open tools platform, it is architected so that its components could be used to build just about any client application. The minimal set of plug-ins needed to build a rich client application is collectively known as the Rich Client Platform.

These rich applications are still based on a dynamic plug-in model, and the UI is built using the same toolkits and extension points. The layout and function of the workbench is under fine-grained control of the plug-in developer. When contributing to the IDE, plug-ins are built on the platform SDK workbench. Alternatively, in a rich client application, developers are responsible for defining the application's workbench presentation.

The same PDE tools are used when developing any Eclipse plug-in contributions, including RCP applications. See the PDE references previously in Section 1.1.2.3, “Plug-in Development Environment,” for more information on this topic.

Other Eclipse Projects

We reviewed the Eclipse runtime platform and several projects that build on the IDE foundation, but there are others that contribute development frameworks and tools. Some of these projects are mature and already in widespread use, while others are just getting started. Additional Eclipse technology projects are not listed here, such as the aspect-oriented programming plug-ins called AspectJ. Although these topics are beyond the scope of this book, you may find additional tools that facilitate your work. Each project has a home page on the Eclipse Web site at www.eclipse.org/projects, or as a subproject within the Tools or Technology projects listed there.

These components can be used to create new Eclipse plug-ins, and many can also be run outside of the Eclipse workbench. For example, the Service Data Objects (SDO) contribute a framework for data exchange in Web Service applications. The Java IDE capabilities described in this book are used when building applications with these components. The components from each project are packaged as a set of Eclipse plug-ins that is added to your workbench using the Eclipse platform update facility.

Some of the components are illustrated as building blocks in Figure 1-3. The layers show dependencies where a component builds on one or more others. In particular, many components build on the capabilities of the Eclipse Modeling Framework (EMF). The dependencies between these components and others in the Eclipse family may be better represented as a graph of relationships instead of a layered architecture, but this figure offers a quick overview of the primary building blocks provided by these components.

  • Graphical Editor Framework (GEF). Allows developers to create a rich graphical editor from an existing application model. The developer can take advantage of many common operations provided in GEF and/or extend them for a specific domain. GEF employs an MVC (model-view-controller) architecture, which enables simple changes to be applied to the model from the view.

  • Eclipse Modeling Framework (EMF). A modeling framework and code generation facility for building tools and other applications based on a structured data model. Provides tools and runtime support to produce a set of Java classes for the model, a set of adapter classes that enable viewing and command-based editing of the model, and a basic editor.

  • Visual Editor (VE). A framework for creating GUI builders for Eclipse; includes reference implementations of Swing/JFC and SWT GUI builders. Intended to be useful for creating GUI builders for other languages such as C/C++ and alternate widget sets, including those that are not supported under Java.

  • Unified Modeling Language 2.0 (UML2). Provides an implementation of the UML 2.0 metamodel to support development of modeling tools, a common XML Schema to facilitate interchange of semantic models, test cases as a means of validating the specification, and validation rules as a means of defining and enforcing levels of compliance.

  • XML Schema Infoset (XSD). A reference library for use with any code that examines, creates, or modifies XML Schemas (standalone or as part of other artifacts, such as XForms or WSDL documents). XSD is a separate Technology subproject, but it is usually downloaded as part of EMF.

  • Service Data Objects (SDO). A framework that simplifies and unifies data application development in a service-oriented architecture (SOA). It supports and integrates XML and incorporates J2EE patterns and best practices. SDO is not a separate project; it is included in EMF as a general application of that framework.

  • Eclipse Test & Performance. Frameworks and services for test and performance tools that are used throughout the development lifecycle, such as testing, tracing/profiling, tuning, logging, monitoring, analysis, autonomics, and administration. The first component was delivered in the Hyades subproject.

  • Business Intelligence and Reporting Tools (BIRT). Infrastructure and tools for designing, deploying, generating, and viewing reports in an organization. Over time, additional subprojects may address Online Analytical Processing (OLAP), statistical analysis, Extract Transform and Load (ETL) tools, and others.

Other components built on the Eclipse platform.Eclipsecomponents

Figure 1-3. Other components built on the Eclipse platform.

Other Eclipse projects use these components, and they are available for your development. For example, the Web Tools Platform uses the EMF, XSD, and GEF components. These frameworks are not described in this book; indeed, entire books will be written about some of the projects (Budinsky, et al, 2004).

Agile Development with Eclipse

Agile software development is a general name for a family of related methodologies, including Extreme Programming (XP), Scrum, Crystal Methodologies, Adaptive Software Development, and others. Its core principles emphasize empowering the programmer through small self-organizing teams, close collaboration with customers, use of iterative development cycles, and continuous unit testing by the developers.

Eclipse provides a development platform that supports and accelerates the iterative agile development cycle. Extreme Programming (XP), as a member of the agile development family, outlines a set of twelve practices for achieving successful results (Beck, 1999). We'll explore five of those practices that are especially relevant to programming activities:

  • Continuous testing with JUnit. Programmers continually write unit tests, which must run flawlessly for development to continue.

  • Refactoring your code. Programmers restructure the system without changing its behavior to remove duplication, improve communication, simplify program logic, or add flexibility.

  • Continuous integration with Ant. Integrate and build the entire system many times a day, every time a task is completed. Integrating one set of changes at a time makes it easy to identify problems and prevents a surprise at the end of an iteration.

  • Team ownership. This requires good tools that enable efficient code sharing and a team culture that encourages such behavior.

  • Coding standards. In agile development processes, the code is of central importance in documenting system design and behavior, and this is possible only when consistent coding standards are used.

Part 2 of this book explains how Eclipse supports each of these agile development practices. Detailed examples are based on a sample application used throughout all chapters.

Sample Application

We'll use a consistent, practical example throughout this book. The example application is built in two iterations of an agile development process. The goal is to present a realistic situation that demonstrates the power of Eclipse without allowing the application's complexity to interfere with your understanding of Eclipse.

The development iterations will be used to build the following application features:

  • Product Catalog. Create a domain model representing product catalog information with several kinds of catalog items, including products, services, and product bundles. Each catalog item includes pricing data and a reference to the supplier.

  • E-Commerce Components. Create a reusable library of components for representing electronic commerce data. This Java library will be based on the XML Schemas and specifications published by the OASIS Universal Business Language (UBL) technical committee.

Distilled

  • The functional architecture of the Eclipse platform is composed of building blocks that add new features to the core runtime platform. Several hundred Eclipse subprojects and independent open source or commercial products build on this platform.

  • Generic IDE support is provided, which is then specialized for Java, C/C++, Web Tools, and other development activities. The generic IDE is a team-oriented workbench supporting multiple perspectives, views, search facilities, debugging, and more.

  • Java Development Tools (JDT) adds specific support for configuring Java projects and a rich environment for editing and debugging.

  • Other languages, such as C/C++, are supported with optional plug-in features available from the Eclipse Web site and other independent projects.

  • The Web Tools Platform (WTP) project is the newest addition to the Eclipse family and will provide an extensible, standards-based platform for J2EE and Web-centric applications development.

  • Eclipse provides a development platform that supports and accelerates the iterative agile development cycle. Specialized features are included for continuous testing, refactoring, continuous integration, collective ownership, and coding standards.

References

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.17.81.201