Best Practices in Organizing Your Code

There are multiple ways to organize your code, and one of the best ways is to through IDL Workbench projects. The advantages of setting up individual projects rather than storing all of your files under one project are:

This topic discusses the following:

Guidelines for Using Projects

Suggested guidelines when using projects in the IDL Workbench include:

Creating a Project

This section describes how to create a project.

Use the file browser to set up a directory in which to store the related .pro files for the paper. In the image below, a directory named TritiumContaminationPaper was created in the local Windows My Documents directory and three .PRO files that were created previously for this paper were moved into the directory.

 

Next, create the project from the IDL Workbench and connect it to the folder that was created on the local computer. Click the New Project icon in the Workbench toolbar.

The New IDL Project dialog appears. In the Name field, type TritiumContaminationPaper.

 

Select the Create the new project from an existing directory radio button, then click the Browse button. The Browse for a Directory dialog appears, which allows you to connect the new project to an existing directory.

 

Navigate to the directory to store the files in. In this case it is the TritiumContaminationPaper directory you created in the first step. Select the directory and click OK. From this dialog you can also create a new directory for your project files if you have not already created it.

The Workbench displays the new project in the Project Explorer. Expand the contents of the project by double-clicking its name to see the .PRO files stored there:

 

Compare the Workbench view of the project with the file browser's view of the folder:

Note that both windows display the .PRO files. Additionally, the file browser displays a file created by the IDL Workbench named .project. This file contains IDL-specific information about the project.

Projects and Path Management

One way to manage your path through IDL is through the project. It gives you a real-time, visual indication of your current path in the IDL Workbench.

By default, if a project's folder is "open" in your IDL Workbench's Project Explorer, then its underlying directory on your computer is automatically included in your IDL path. Conversely, if a project's folder is "closed," then its directory is not included in your IDL path. Note that you can override this behavior when creating a project.