THE PROGRAMMING ENVIRONMENT

Every programmer creates a programming environment to suit the needs of particular projects. In some cases, such as Liberty Basic, the programming language comes complete with a built-in editor and the capability to save program files. In the C family of languages, programmers can use their favorite editing environment with a separate compiler and debugger, or use an IDE (Integrated Development Environment).

You'll learn more about IDEs in a minute, but first consider editing programs with a separate application. Although it's certainly possible to edit a Web page (including JavaScript) with the Notepad application that comes with Windows, editors designed specifically for programming can provide some helpful functionality and are cheaper than an IDE. Some features to look for include:

  • Syntax color-coding: The editor is aware of key words used in the programming language you are writing and can color code the various elements.
  • Project organization: The editor enables you to define a project file that remembers all of the files you're using as well as your custom settings. Opening the project file puts you back at the point you were working on when you closed the project.
  • Tool running capability: The editor enables you to define jobs that can be run without leaving the editing environment. Typical jobs might include compiling the program or copying files.

You might find a programmer's editor called UltraEdit32 to be exceptionally useful because has all of these features.

Put It All Together with IDEs

IDEs are very popular tools for writing programs. These environments usually, at a minimum, combine a customized text editor for entering code and tools for debugging. In most IDEs, for example, you can run a program line by line, walking through the instructions as they're processed (called tracing or stepping through a program). The debugger can display the value of variables as they change when statements are executed. This is a useful feature when you're trying to figure out which statement draws an incorrect line in a complicated graphic, or has an error in a long mathematical function or method.

Many IDEs do more than just this. Many programming tasks, such as programming graphical interfaces (windows, toolbars, buttons, and so on) or writing C code to interface with a SQL database, for example, are complex but tend to be written in standard ways. Some modern IDEs provide tools to help write this code for you.

Some of the most popular examples of modern, powerful IDEs include:

  • Visual Studio .NET : This widely respected IDE from Microsoft provides the same working environment for C#, Visual Basic, and a number of other Microsoft languages in the .NET family. The main disadvantage is that it's rather expensive.
  • Borland IDEs : Borland makes IDEs for Java, C++, C#, and Delphi programming plus many design tools. Special personal versions of these tools that run on both Windows and Linux are available for free downloading, and are ideal for students.
  • WebSphere Studio: The latest IDE for Java and JavaScript programming from IBM emphasizes development of Web services.
  • CodeWarrior: This line of IDEs from Metrowerks is for C, C++, and Java programming on all desktop environments. Versions for embedded devices such as cell phones are especially popular. Free or low-cost student versions of some products are available.

Many of the modern IDEs provide tools for generating graphics instructions. For example, you can actually drag and drop graphical components from a palette onto a drawing board that represents what becomes the finished user interface. After you've drawn your graphical components, you can then see the instructions the IDE has written that causes those graphical components to be drawn.

As you can imagine, it's often easier to have an IDE write hundreds of lines of code to draw an application's window than it is to do it yourself. The catch is that to have your interface actually do anything other than trivial tasks (such as just being displayed), you usually have to customize the code later.

When you have the IDE write a lot of the code, you also lose some control over how you can rearrange the program later, particularly if you want to use the IDE's tools to generate more instructions after you've modified what it's created. Nonetheless, using IDEs in this way has become common in recent years, as the graphics used in most programs have grown more complex and programming projects try to get more accomplished in less time.

Specialized Programming Utilities

There are many other utilities that the programmer can call on for assistance in accomplishing various chores. For example, when dealing with the HTML markup language, you can use the HTML TIDY program to check for correct usage of markup tags. You might be surprised at the number of mistakes TIDY can find in Web pages.

If you're programming applications for desktop use, it's easy to try the program on your development system; however, if you're programming for an environment such as a cell phone, things get tricky because a cell phone doesn't offer much debugging help.

The emulator is the savior of countless hours of cell phone developer time. A cell phone emulator creates a virtual cell phone on your desktop where your program can be run under more control. A good example is the Java J2ME Wireless Toolkit . It provides a desktop interface, as shown in Figure 8-1, that lets you control a development project that targets a cell phone environment.

Figure 8-1: The wireless toolkit user interface building the games project.
Figure 8-1: The wireless toolkit user interface building the games project.

View a larger version of this image.

When the program has compiled without error, you can load it into the cell phone emulator and run it, as shown in Figure 8-2. All of the emulated cell phone buttons work as expected to control the program.

Figure 8-2: The games project running in an emulator.
Figure 8-2: The games project running in an emulator.