Using Integrated Development Environments for Program Development - dummies

Using Integrated Development Environments for Program Development

By Richard Blum

The laser-guided miter tool for program development is the integrated development environment (IDE). IDE packages provide everything you could possibly need to develop any size of web application.

Here are some of the advanced features IDE packages provide:

  • Code completion: Start typing a code statement, and the package will provide a pop-up list of statements that match what you’re typing. It also shows what parameters are required and optional for the statement.
  • Code formatting: The IDE automatically indents code blocks to help make your code more readable.
  • Program execution: You can run your code directly from the editor window without having to jump out to a web browser.
  • Debugging: You can step through the program code line by line, watch how variables are set, and see whether any error messages are generated.
  • Project and file management: Most IDE packages allow you to group your application files into projects. This allows you to open a project and see just the files associated with that application. Some will even upload the project files to your web-hosting site for you, similar to what the graphical desktop tools do.

Using an IDE tool is not for the faint of heart. Because of all the fancy features, learning how to use the IDE interface can be almost as complicated as learning the programming language!

There are both commercial and open-source IDE packages available for the PHP environment. To give you a general idea of how IDE packages operate, check out two of the more popular ones: Netbeans and Eclipse.

Netbeans

The Netbeans IDE package was originally developed by Sun Microsystems and released as an open-source IDE for its Java programming language environment (thus the “beans” part of the name). When Oracle acquired Sun, it maintained support for Netbeans, and continued development of it with updated releases.

The Netbeans IDE now contains support for several different programming languages besides Java by using additional plug-in modules. As you can guess, the reason I’m mentioning it here is because there’s a plug-in module for PHP.

You can download the Netbeans editor with the PHP module already installed, making it easy to install. Just go to netbeans.org/downloads and click the Download button under the PHP category.

When you start Netbeans, it will prompt you to start a new project.

Netbeans
The Netbeans project dialog box.

Netbeans contains project templates for HTML and JavaScript applications, as well as PHP applications. When you start a new PHP project, Netbeans automatically creates an index.php file as the main program file for the project. It even builds a rough template for your code. As you would expect from an IDE, when you start typing a PHP function name, Netbeans opens a pop-up box that shows all the PHP functions that match what you’re typing.

Not only does it show the code completion list, but it also shows you the PHP manual definition of the function! This is certainly a handy tool to have available if you plan on doing any large-scale PHP development.

Eclipse

The other big name in PHP IDE packages is the Eclipse PHP Development Tool (usually just called Eclipse PDT). Eclipse was also originally designed as a Java application IDE. Many open-source proponents didn’t trust Sun Microsystems maintaining the only IDE for Java, so they set out to develop their own. (The story goes that there was no intentional wordplay on the name Eclipse versus Sun Microsystems. If you can believe that, I may have a bridge to sell you.)

Just like the Netbeans IDE, Eclipse evolved from a Java-only IDE to support many different programming languages via the use of plug-in modules. You can download the Eclipse PDT as an all-in-one package at eclipse.org/pdt.

Just like the jEdit editor, Eclipse PDT is written as a Java application and requires that you have a JRE or JDK installed on your workstation.

When you start Eclipse, a menu system appears.

Eclipse
The Eclipse start menu.

This allows you to easily change the IDE configuration, start a new project, or open an existing project. Eclipse has all the same features that Netbeans offers. Plus, it has one additional feature: Eclipse PDT contains the advanced PHP Debugger tool developed by Zend, the company that sponsors PHP. The Debugger tool can help point out errors in your PHP code immediately as you type, or it can debug your code as you run it in the Eclipse editor window.

PHP debugger
The PHP debugger in action in Eclipse.

Having an advanced PHP debugger at your fingertips can be a great time-saver when you’re developing large applications!