TOC PREV NEXT INDEX

Put your logo here!

The Essence of Object Oriented Programming with Java and UML


Chapter 10

Software Tools for Object-Oriented Development

Just as a carpenter needs a good set of tools, so does a programmer. The question is, which tools should you use to develop your Java programs? In this chapter, we will look at some specific software tools that can make your programming task easier. The final selection of just which tools you will use will probably be a combination of personal choice and which tools that are used at your workplace. But it is good to know not only about specific choices, but of the broad categories of software tools that are available to use.

Discussing specific software products is a somewhat risky proposition for a book that will likely outlast some of the products covered. In today's volatile software industry, products come and go as companies go out of business or merge with other companies. Some of the specific tools covered here are likely to be around for a long time to come1, while you may find some no longer available. However, if some specific tools is no longer available, then there will certainly be a descendent or similar product available. What is most important is to be familiar with the range of software tools you have to choose from. The book's web site will try to keep up with the latest status of the tools discussed here.

GUIs vs. Consoles

Today, most new software tools are developed to use a full graphical user interface, either on MS-Windows or a graphical environment on a Unix-like system (e.g., Gnome on Linux or Motif on Solaris). And some of the best Java tools are written in Java, and run the same on any Java platform.

It hasn't been all that long, however, since most programming was done using 24 by 80 character terminals, and then console windows on a graphical system. Many different tools were available to run in a console based environment.

Many long-time programmers consider Unix and its descendents such as Linux to be the ultimate development platform. The programmer's tools include a choice of editors, a compiler system, and a set of many powerful tools such as grep, diff, make, lex and yacc that work together2 to help the development process. One of the most powerful tools found on Unix-like systems is the command shell which allows the programmer to write scripts to automate much of the development process.

The following is a list of just a few of the standard software tools found on Unix-like systems.

Today, Linux is the best known Unix-like system, and includes all the well known software tools. These tools are also available today as free open source software under the GNU Public License. There is a ready-to-run version known as Cygwin (www.cygwin.com) available to run on MS-Windows platforms. While these tools were developed before Java, they still be very useful for many aspects of developing a program, including a Java program.

Editors and IDEs

The editor you use is a very personal choice. Programmers are known to get into long and passionate debates about which editor is best. This section will discuss some of the characteristics of programming editors, as well as Integrated Development Environments (IDE), which are GUI based development tools that integrate the editor with various other tools such as the compiler.

Characteristics of a Good Editor
Easy to use command set

First and foremost, an editor should have a very easy to use command set. If you touch type, and like to keep your hands on the keyboard, any editor that requires you to use the mouse extensively is less than ideal.

The command set must easy to learn and use. Once you know the command set, your fingers will automatically do the right thing. You will barely have to think about what you are doing. Ideally, the most common commands will require you to press only a single key (or perhaps a single key combination). Less commonly used commands can use two or three key sequences. There should be some logic to which keys are used for which command (like using S or F for search or find).

The command set must be comprehensive. All editors will let you move around the code and perform basic edits, but a programmer's editor should have other features. Some examples include easily splitting lines, changing case, matching parens, automatic indentation, and code formatting.

Powerful finds

Being able to search for just what you want in your code is important. Good editors will include some kind of extended pattern matching in their find commands. Being able to search for regular expressions is considered essential by many programmers.

Another kind of search that is especially useful to programmers is to find the definition of some symbol, or all the references to a symbol. This is also an essential feature for any good editor.

Macros

Programmers will commonly need to carry out some repetitious task when editing. At the most basic level, that could be renaming all instances of a variable. But a programmer should be able to repeat any specific sequence of commands. Thus, an editor should have the ability to define arbitrary sequences of commands and execute them. These are often called macros.

Language awareness

Any good editor will be programming language aware. At the very least, this will mean the editor will do syntax highlighting of the source code. Other common language aware features include automatic completion of keywords, availability of code templates for common language constructs, and context sensitive help for a given language.

Integration with other tools

More and more, it is becoming important for an editor to provide some integration with other programming tools. While it is still possible to be extremely productive using multiple command shells in a Unix-like environment, some features are becoming a standard part of the editor. These features include the ability to work directly with the compiler, and to go directly to code lines with syntax errors. Other integrations can include interfaces to file search utilities, interface designers, class browsers, and the like.

Three Types of Editors

Currently, there are three flavors of editors: modeless and moded programmer's editors which have evolved from console based systems, and editors that are entirely GUI based. Which kind of editor is best is a highly personal preference.

Standard modeless editing

Most editors you will encounter can be classified as modeless editors. That is, normal character keystrokes are entered as text into the file, while commands require special keys or multi-key combinations to distinguish them from regular characters. The command keys are often not on the main home keyboard (e.g., arrow keys), or use a second key (e.g., Alt) that borders the main keyboard. This means either slowing down your editing while you move your hand, or awkward finger movements that have been known to generate sore pinkies used to press the Alt key. The best known modeless programmer's editor is Emacs.

Moded editing

In a moded editor, there are generally two different modes: command mode and insert mode. When the editor is in command mode, pressing any key is interpreted as a command, and will be carried out. In order to insert text, you have to enter insert mode by entering the insert command. There is then a single special key used to escape from insert mode back to command mode. One of the primary advantages to moded editors is that the regular keys can represent commands, and that you don't need to press special keys or special key combinations to enter a command. Thus, the "f" key could represent the "find" command directly. All your fingers can usually stay firmly planted on the home row of the keyboard. The best known moded programmer's editor is vi.

This two moded editing can seem strange and frustrating to someone first using a moded editor, especially since almost everyone has done at least some editing on a PC where any text you type appears on the screen. Nothing happens in moded editor until you go into insert mode. But some informal studies have shown that expert users can edit faster with a moded editor. The main reason is that your fingers don't need to leave the keyboard to fumble for special command keys as they must in a standard editor.

GUI-based editing

A GUI based editor will work only on a GUI based platform such as MS-Windows or X Windows. They are heavily oriented to using the mouse and arrow keys. GUI based editors are almost always modeless. Most GUI based IDEs will have an editor with a default command set that is GUI oriented. There are usually keystroke equivalents for most commands. The problem with many GUI based editors is that they are too generic. They are often missing the more specialized commands a programmer needs and expects. While an IDE may have many useful features, the default editor is often underpowered compared to the more specialized programming editors like vi and Emacs. Ideally, you should be able to substitute either your own editor, or you own editing command set.

Emacs

One of the most widely known and popular programming editors is Emacs. Emacs was originally written in the mid-1970's by Richard Stallman, founder of the Free Software Foundation and responsible for much of the core GNU software package. The current version is known as GNU Emacs.

At its simplest, Emacs is a modeless editor. However, it really is much more. It contains its own LISP language engine which is used to write extensions and macros for the editor. The GNU Emacs system is very large, and can be made to carry out almost any task a programmer will likely want or need to do. It is possible to control the entire programming process without leaving the Emacs environment, and many people claim Emacs is really the ultimate IDE.

All this power is not without a cost, however. While basic editing with Emacs is not difficult, the vast power of Emacs takes significant effort to learn. Most Emacs users say that taking the time to learn the full power of Emacs is well worth it in long term dividends.

One of the best things about Emacs is that there is only one main version in widespread use for virtually every programming platform available today. It is free under the GPL. Emacs is a standard part of every Linux distribution. The full distribution of GNU Emacs, including full source code and the MS-Windows executable binary, is on the CD accompanying this book. The GNU Emacs web site is www.gnu.org/software/emacs/emacs.html.

Vi

Vi is another editor very popular with many programmers. It was originally developed by Bill Joy, co-founder of Sun Microsystems, back in the mid-1970's while he was a student at Berkeley. It became the standard visual editor for Unix.

Vi is a moded editor - there is command mode and insert mode. The commands are typically single character commands like `x' for delete a character or `h' to move the cursor one character left. Others are two letter commands like `dd' to delete a line or `dh' to delete a character left (there is a whole set of `d' delete commands). While the command set seems a bit obscure, it is actually very efficient once you know it.

Vi and Emacs share one important legacy. The were both developed when programmers were just first starting to use terminals connected to time sharing systems. These terminals were connected to the computer at only 300 or 1200 Baud3. The terminals themselves were very primitive when compared to the GUI systems available today. Thus, both Emacs and vi were designed when even getting the text on the screen was a challenge, and the commands needed be simple one or two character sequences.

One interesting bit of trivia about the vi command set concerns the choice of the letters "hjkl" for the left, up, down, and right cursor movements. In the mid-1970's at Berkeley, the most common terminal around campus was an ADM-3a. The terminal was not very versatile, but it was cheap. There was no separate keypad for arrow keys. Instead the ADM-3a had arrows printed on the hjkl keys, which were usually used in combination with the Control key. Vi simply uses hjkl.

Figure 10-1.
VIM editor

Unlike GNU Emacs, there is not a standard version of vi available. The original was a part of the commercial Unix system, and is not free for general distribution. There are, however, several free clones available. The most popular is VIM, or vi improved (www.vim.org). It is totally freeware, and the source code and an executable version for MS-Windows are included on the accompanying CD.

Integrated Development Environments

Integrated Development Environments (IDEs) are designed to support the most common programming tasks in a single program. Some IDEs work with multiple languages, but many are designed for a specific language such as Java.

While the feature set of IDEs will vary among products, most IDEs will have the following features:

The following sections discuss some IDEs for Java.

VIDE

VIDE is a small, free IDE written by the author of this book. It is uses the author's open source V C++ GUI Framework. Compared to some of the large commercial IDEs, VIDE is very small and fast.

VIDE supports both C++ and Java. C++ support includes the GNU g++ compiler and the free Borland C++ command line compiler. VIDE also supports the Sun's Java development environment, which is available for free download at java.sun.com.

The default VIDE editor supports a standard GUI modeless command set. It includes other important editing features like macros, code indentation, syntax highlighting, and symbol browsing. It also supports two moded command sets - a subset of vi, and the See command set developed by the author.

The fact that VIDE is small and simple is both its strength and its weakness. It really is quite simple to learn to use, and supports almost all the basic tasks a programmer needs. However, it lacks some of the language specific features found in full blown C++ or Java IDEs, or the comprehensiveness of Emacs.

Figure 10-2.
VIDE

Even so, because VIDE is free, small, and so simple it has been adopted as a recommended choice by several introductory computer programming courses at universities and colleges around the world. An executable version of VIDE is included on the accompanying CD, and there are VIDE project files for all the Java code examples found in this book.

Borland JBuilder

Borland JBuilder 54 may be the best Java IDE available today. It consistently shows up as a programmer's favorite in internet discussion groups, and it gets favorable reviews in various magazines.

Like most Java IDEs available today, JBuilder is written in Java for Java programming. This means that it is available for all Java platforms, and it is designed very specifically to support Java and associated Java packages such as Swing.

Borland is distributing JBuilder 5 in three different versions: Personal, Professional, and Enterprise. Each version supports different features, with the Personal edition being the most limited.

Figure 10-3.
Borland's JBuilder 5

The Personal Edition of JBuilder is available for download from Borland at no cost (www.borland.com). Even better, there is a copy of JBuilder 5 Personal on the book CD. This is really an amazing piece of software, and it is free5.

All versions of JBuilder, have the following features:

The features included in the Personal edition are really very complete, and can be used to build almost any Java application. However, the Professional and Enterprise editions have significant features that make it easier to develop more advanced Java applications. It is important to remember that a programmer's time is very expensive, and that providing the appropriate tools will almost always be cost-effective.

The Professional Edition has the following extra features:

JBuilder Enterprise adds even more, including support for Enterprise Java Beans, distributed computing applications, CORBA support, and JSP support. Any company building Java applications at this level will understand the capabilities needed to support their development.

Borland also has some interactive training CDs that can help you learn JBuilder quickly. These training tools are likely to be quite cost-effective at getting new programmers up to speed.

A feature list is only the first step in evaluating how good a program really is. Reading reviews and what other users have to say about a product is another important step, and JBuilder really stands out here. And finally, the only real way to know if a software tools is right for you is to use it and evaluate it. The very best programs have all the features you need, yet are also easy to learn and to use. JBuilder seems to meet this last test better than some of the other IDEs such as Forte.

While JBuilder is very good, it has some faults. Programmers used to all the editing features of Emacs, vi, or even VIDE might be disappointed in JBuilder's editor. Setting up projects has a few quirks in how directories are set up and used, but that is just matter of learning the tool's conventions. And JBuilder suffers the same problem as many Java-base applications - it is slow to load, and sometimes a bit slow in its response. This is especially noticeable on slower machines.

There is another issue to be aware of when using JBuilder, or any of the other Java IDE), and that is the automatic application generation tools. These tools let you build simple GUI applications rather easily, but you build them the way that the tools have decided. For example, when you use the JBuilder application wizard to build an application from scratch, it starts by creating the top level class that extends JFrame. While this is a standard way of building Java applications, it is not necessarily what you want to do. Be sure you use the tool to build the programs you want using good object-oriented design, and don't get trapped into using a design structure provided by the IDE by default.

As noted earlier, a full version of the free Personal Edition is on the book CD. You will have to register this version at Borland's web site. If you are a student or associated with an educational institution, Borland provides highly discounted prices for the Professional and Enterprise editions. You can check Borland's website for details. There are JBuilder project files for all the Java code examples found in this book on the CD as well.

Sun Forte

Sun Microsystems distributes a Java IDE called Forte. Forte is very similar to JBuilder in many ways. While JBuilder seems to do better in reviews than Forte, there is a rapidly growing Forte community.

Sun provides two editions of Forte, a free community edition, and an enterprise edition. The community edition has more features than JBuilder Personal. For example, there is support for JDBC. As would be expected, the enterprise edition has support for enterprise wide networked applications and other advanced features.

Forte's editor in some ways seems more advanced that JBuilder's. It has macros, and is customizable even in the free version. However, the JBuilder editor has more total commands, and comes with several predefined command sets. On the other hand, the code generated by JBuilder's User Interface designer seems cleaner and easier to modify than Forte's.

In the end, the decision on which IDE, if any, to use is usually very personal. In a large enough project, it is possible that a whole team will have to use the same IDE because of the support they give for version control and project coordination, but the important issue is to use the tool that maximizes your productivity.

Since both Borland and Sun have free versions of their IDEs, it is probably worth some effort to try both if you haven't yet settled on a specific tool. JBuilder and Forte aren't the only Java IDEs available. The next section briefly covers some others.

Other IDEs

There are other IDEs available. Perhaps the most significant is IBM's VisualAge for Java (www-4.ibm.com/software/ad/vajava/). It has several editions, including a free version for download (although the download size is huge). The design philosophy and work model supported by VisualAge is significantly different that most other IDEs, and has a significant learning curve. However, many VisualAge users claim that its approach is much better than other IDEs once you are accustomed to it.

Source code control

A version control system keeps track of all the changes made to a set of files. For an individual developer, that means being able to keep track of all the changes made to a program during the entire time it has been in development.

Version control systems are not only valuable, but are essential for development teams. Not only do they track changes, but they allow programmers to check out individual files, make changes, and then have those changes merged back into the main source code repository.

CVS is the Concurrent Versions System, and is currently the most widely used version control system. It is open source, and works on individual computers, or over any computer network, thus making it useful for both the individual and the team.

There are other version control systems available such as rcs and sccs, but CVS is the most popular. Most IDEs will either have their own version control features, or integrate with CVS or another system.

Complete information about getting and using CVS is available at www.cvshome.org. It is open source, and freely available. Using a version control system is an essential programming practice, and CVS is as good as any system available.

CASE, Modeling, and UML Tools

CASE stands for Computer Aided Software Engineering. When CASE tools were first conceived, many hoped they would revolutionize software development. So far, this has not been the reality. While CASE tools can be very useful and help keep a project on track, practices such as object orientation have proven to be more useful.

There are several kinds of CASE tools available. IDEs can be considered the most basic CASE tool. Usually, however, CASE tools are tied to some specific software development philosophy or management practice. One of the most common category of CASE tool includes the software modeling tool. Specifically, there are many tools that are used to design and implement software using the UML. Some are methodology independent, and others are tied to a specific one.

Other CASE tools are more comprehensive, and contain tools for developing software using a specific methodology. They can include such features as building specific kinds of management charts and time lines, code tracking, bug tracking, process management, and more.

While there are a few free and open source CASE tools available, so far none yet match the functionality and quality of commercial tools. Unfortunately for the small company or development team, most commercial CASE tools are very expensive, typically costing several thousand dollars per seat. A few are available for just a few hundred dollars, and can really help the productivity of a small development team (and can be suitable for large teams as well).

ArgoUML

If you want to try a basic UML design tool, check out ArgoUML. ArgoUML is an open source project to develop a full UML design tool. As this book is being written, the ArgoUML project has been under development for several years, and shows real promise of becoming an excellent open source UML tool. Best of all, you can try working with UML using a free tool.

While not as capable as commercial products, it can generate basic UML diagrams, and has some interesting design critique features. Because it is an evolving program, it is not included on the book CD. The download of the latest version is available at www.argouml.org.

MagicDraw

MagicDraw (www.magicdraw.com) is one of the more affordable UML modeling tools currently available. It supports the entire UML standard, and is easy to learn and to use. It is almost in a class of its own given its features and price. MagicDraw was used to produce all the UML diagrams for this book, and a demo version is included on the book CD.

MagicDraw facilitates analysis and design of object-oriented systems and databases. It supports the latest standards of Java, UML and XMI and provides the comprehensive code engineering mechanism, with full round-trip support for Java, C++, and CORBA IDL programming languages. MagicDraw also provides database schema modeling, DDL generation and reverse engineering facilities.

MagicDraw has a reasonably priced Standard Edition with these basic features:

The slightly more expensive Professional Edition adds:

Figure 10-4.
MagicDraw UML Design Tool

The code generation and round-trip capabilities of the Professional Edition will be well worth the extra cost for most teams. MagicDraw's capabilities are on par with most other UML tools, and deserves serious consideration.

Rational Software

Rational Software has a full suite of software development tools. Rational Rose is their full featured UML based modeling tool. It is the standard by which all other modeling tools are judged. They also have tools to manage the Rational Unified Process.

Committing to Rational is essentially committing to an entire development philosophy. The tools are expensive, and most likely to be used by large development organizations. The decision to use Rational products will usually be made at a company or project level. See www.rational.com.

TogetherSoft

ToghtherSoft was founded by Peter Coad, who helped developed the Coad-Yourdon object-oriented analysis and design methodology. The main product of TogetherSoft is ControlCenter. ControlCenter is not methodology specific, and is more than a modelling tool.

TogetherSoft calls ControlCenter a Model-Build-Deploy Platform. Their web site says "With it, you can: model - EJB - pattern - edit - compile - debug - version - doc - metric/audit - provision - assemble - deploy - run." It has a UML tool, a programming editor, round-trip code engineering, software matrix tools, and more. It is a total CASE tool.

ControlCenter is an alternative to Rational Software products. It is expensive, and likely will take an organization-wide commitment. See www.togethersoft.com.

Other UML Tools

mUML

mUML is very low cost UML tool that is worth checking out. It is supported by a small company, Mount Field Computers. It supports all UML diagrams, and will generate Java code, and can perform reverse engineering. While not as full featured as MagicDraw, it quite capable, and was available for less than $50 when this book was written. See www.mfcomputers.com.

ObjectDomain

ObjectDomain is a UML modeling tool that supports C++ and Python as well as Java. See www.objectdomain.com.

SoftModeler

SoftModeler is another full featured UML modeling tool. There are three versions, starting at a reasonably priced Standard Edition. The Professional edition adds support for modeling JavaBeans, and the Enterprise edition has support for shared projects. See softera.com.

Other Java Tools

JUnit

JUnit is an open source regression testing framework written by Erich Gamma and Kent Beck. It is used to implement unit tests for Java programs. JUnit is an important tool to use when refactoring code, and with XP. JUnit is in active development, and can be downloaded at junit.org. JUnit can be integrated into JBuilder.

Jikes

Jikes is an open source Java compiler from IBM. It is an alternative to the compiler that comes with Sun's JDK. While Jikes is often mentioned in discussions of Java compilers, the future of Jikes is not clear. For the latest information about Jikes, see oss.software.ibm.com/developerworks/opensource/jikes/.

1
Specifically, open source tools such as Emacs are likely to be around for as long as programmer's need an editor. This long lifetime is an often under appreciated advantage of open source software.

2
The output of one tool can be fed to the input of another tool to build powerful chains of commands.

3
Just consider how slow even a 28,000 Baud connection to the internet seems today.

4
Version 5 was the latest as of the writing of this book. New versions are available on approximately an annual basis.

5
There is a real difference between open source software, and software that is free. Open source software is freely available, and anyone can use and modify the source code. Open source software can be redistributed under the open source license. JBuilder is not open source software, even though the Personal edition is free. Borland has not released the source code, and controls distribution.


TOC PREV NEXT INDEX

The Essence of Object-Oriented Programming with Java and UML (DRAFT)

Copyright © 2001 by Addison-Wesley

All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form, or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior consent of the publisher. You may view this document on a web browser, but you must not mirror or make local copies.