3 May 2011
Adobe ColdFusion Builder is the newest ColdFusion IDE to come to the market, and it is designed with the ColdFusion developer in mind. Unlike other IDEs, which only allow developers to write CFML, ColdFusion Builder allows developers to connect directly with the ColdFusion server and expand their development experience. ColdFusion Builder not only allows for easy management of development and live servers from within the IDE, but also for more robust debugging through built-in validation and debugging services. Additionally, features such as Quick Fix and Custom Code Formatting increase productivity and allow you to style your code in your own way.
For anyone who has used Eclipse, or even Flash Builder to a lesser extent, the interface will seem very familiar. This is because ColdFusion Builder is built on the Eclipse Platform. The same principles that Eclipse uses, such as workspaces and projects, still exist in ColdFusion Builder, although modified to specifically meet a ColdFusion developer's needs. For those of you who have never used Eclipse before, some of these concepts may seem alien, so in the first section you'll have a chance to open up ColdFusion Builder, take a deep sniff of that new IDE smell, and look at some of the basics before going too deep into the features.
ColdFusion Builder allows you to use multiple workspaces within the IDE A workspace is what you see when you open the IDE –the different projects, panels and settings. You can have multiple workspaces, which means you are able to set up multiple environments. A common use of workspaces by developers is to set up a work development workspace and a personal development workspace. All projects and servers are specific to the workspace, so this allows them to avoid confusing business and personal code.
The first time that you open up ColdFusion Builder (and possibly every time you open it unless you select a default workspace and specify that you don't want to be asked again), you will be prompted to select your workspace. In this context, the workspace is a folder in which all the settings are stored. If you do not plan on using multiple workspaces, you can select to choose a default workspace and not go through this step again. If you ever do need to change workspaces, you can easily select the new one by choosing File > Switch Workspace.
Unlike some other IDEs, ColdFusion Builder uses projects rather than a simple file explorer system. Projects allow you to bookmark the location of the files that you are using during your development process as well as supply additional information such as server details and external files. The additional information that you provide, besides the names and locations of files, will enable you to run and debug your application from the IDE. You can also specify additional files that you want the application to have access to, such as framework files or global files. For some, the idea of having to set up a new project whenever you need to make updates to code that is not already in a project may seem arduous. But in the long run, the benefits will outweigh the few minutes of set up time. For those who only want to make a quick update to a file and do not want to create a project at all, there is a file explorer view that does allow you to navigate to files through a file tree.
Follow these step to enter create a new project:
Note: No two projects can have the same name.
At this point it is possible to click Finish to create a project. If you do, however, you will not have access to all the features within ColdFusion Builder. To fully set up your project, you must follow the next two steps in the Project Builder Wizard.
You now have a fully configured project, which is displayed in the Navigator view. To change any of these settings, right-click the project and choose Properties.
A developer's IDE is a very personal thing, and it would be impossible to package an application that lays everything out in a way that would please everyone. Sometimes simple layout changes, such as keeping the Problem panel visible or hiding the File Explorer panel, can significantly improve productivity. To account for everyone's needs, ColdFusion Builder offers highly customizable perspectives. The different layouts of the IDE, which panels are visible and where those panels are located, are called perspectives. By default, ColdFusion Builder installs with two perspectives, the ColdFusion perspective and the Debug perspective. Clicking on one of the perspectives on the top left will change the layout to that perspective. While viewing any perspective, you can move or close any of the panels on the screen, and your changes will be remembered (see Figure 1).
In addition to being able to update the two default perspectives, you can also create new ones. After changing the current perspective to your preferred layout, choose Window > Save Perspective As to create a new perspective. The new perspective will then be listed with the others at the top of the IDE. If after moving some of the panels around, you decide that you preferred them where they were originally, simply choose Window > Reset Perspective, and your perspective will be returned to its default settings. Perspectives allow you to create multiple layouts for different tasks. When working on CFCs, for example, you may need to have the outline panel clearly accessible. When interacting with remote code, you may want easy access to the RDS panels. You can create different perspectives for each of these scenarios, and tailor them to provide the optimal layout for their respective tasks.
In addition to the workspace layout, there are many little things that can affect the coding experience for a developer, from font size to code assist delay times. All these settings are controlled through the preferences settings in ColdFusion Builder, and they can be easily located using the filter search feature. Gone are the days where you had to click on all the different types of preferences, trying to find the right area to update a setting. Start typing, and the filter will show you all matching settings.
The formatting of code, just like the layout of a developer’s IDE, is a very personal thing. As developers, we all like code to be formatted in a specific way, which allows us to easily read the code and find the key pieces of information easily. Normally, when code is auto-generated, our code is forced into a format that the IDE creators feel is the best format, or we spend time going through and correcting the code. Not only does this slow down development time - it is also highly annoying. With ColdFusion Builder, you have control over how ColdFusion Builder formats your code; you can create multiple formatting profiles that store your preferred formatting options.
The profile creation wizard lets you create code formatting rules. The rules are split between indentation, spacing, code wrapping, and braces. From these screens you have the ability to set your preferences, even down to the granular level of when ColdFusion Studio should put a space before the closing > character, to specifying which tags should always be self-closing, to how many spaces or tabs should be used when indenting code. If you use ColdFusion Builder on multiple computers, you can easily transport the profile by exporting the profile from one computer and importing it to another.
To create a custom code formatting profile, go to Preferences > ColdFusion > Profiles > Editor > Formatter. From this screen, you can create a new profile by clicking the Add button at the bottom of the screen.
Once you have your profile set up, all auto-generated code will conform to these formatting rules. If you have old files, want to update code you wrote yourself, or are working on someone else's files, you can update the code to your personal format. To do this, highlight the code, right-click the highlighted code, and select Format, or press CTRL + Shift + F (or Command + Shift + F if you are on Macintosh).
One of the main focuses of ColdFusion Builder has been to improve the productivity of the developer. This is evident in features such as Code Assist, file preview, and access to servers (covered later in this article). Adobe knows that it is not possible to create an IDE that functions just as every developer needs, so they have allowed for a number of features to be customizable. Code formatting is one area that allows for customization, and shortcut keys is another. It is safe to say that developers will use shortcuts for the commonly used ColdFusion and HTML tags, but there are often tags (including custom tags) or functions that different developers use on a daily basis that it would be useful to bind to a shortcut. With ColdFusion Builder, you can create custom keyboard shortcuts, providing the code to insert, as well as the key combination to type to get the shortcut.
To access the shortcut profile page go to Preferences > ColdFusion > Profiles > Keys. From this screen you can see all the shortcuts that are currently set.
Follow these step to add a new shortcut:
When writing code, it is common that you will reference a function or file that you have not yet created. You do this knowing that the plan is that you will create the function or file once you have completed the section of code you are working on. With ColdFusion Builder Quick Fix feature, you can now easily create your functions and files using the information you have already typed in the file.
For example, let’s say that you are writing some code that references a function called
simonSays. This function does not yet exist. ColdFusion Builder detects that the function does not exist and places a Quick Fix icon next to that line of code. Clicking on that icon, or pressing CTRL + 1, (Command + 1 on a Macintosh) will create a function tag called
simonSays. The function will have the same number of arguments that you have used when referencing the
simonSays function earlier on. Similarly, if you were including a file that does not exist, the Quick Fix will create the file for you in the path that was specified in the include tag.
ColdFusion Builder enables you to set up instances of your different ColdFusion servers. These instances can be local or live development environments. They allow for thorough testing and debugging prior to the code being pushed live. From within ColdFusion Builder, you can launch the ColdFusion Administrator as well as the Server Monitor, enabling you to update settings and see the impact your code has on a server. Through the Server panel you can also start, stop, and restart the server without ever having to open up any services windows. For those of you who, like me, enjoy creating server-crashing code, these features have the potential to save a lot of development and debugging time. They also make life much easier if you do not wish to have ColdFusion running when you are not using it.
To create a local server instance follow the steps below:
To add a Remote server, you must first make updates to the Live ColdFusion server. More information about these updates can be found in the documentation.
Now that the server has been registered, you can start, stop, or restart the server by clicking the appropriate buttons in the Server panel or by right-clicking on the server and selecting the action you wish to perform. If at any time you wish to access the ColdFusion Administrator or launch the Server Monitor, right-click the server and select ColdFusion Administrator or Launch Server Monitor. Either action will expand the Server panel and display the interface within ColdFusion Builder.
ColdFusion Builder offers many debugging options, from simple syntax highlighting to full blown step-by-step debugging. Whether you are looking for as-you-type-debugging or a debugging and testing platform, ColdFusion Builder has you covered.
Like most IDEs, ColdFusion Builder checks the code as you type, looking for anything it does not recognize as valid CFML. If it finds any inaccuracies, the issue is underlined by a dotted red line. A red circle with a white X is displayed on the left of the screen on the corresponding line number, to alert you to the issue. If you move the mouse pointer over the X, ColdFusion Builder provides additional details on what the issue is and, unlike some IDEs, a suggested resolution. For those of you who write extremely long files, a red square will be displayed on the right of the editor, next to the scroll bar, denoting that an issue has been identified. The position of the square shows you roughly where the error is in the document; the lower the square is, the lower the location of the error in the document.
The Problems panel lists all problems ColdFusion Builder has found in all open documents, providing you with the file name, project name, and location of each issue. Double-clicking a problem will move the focus to that problem's file and move the cursor to the location of the problem. The cursor will not always be positioned exactly where the problem began, as it is possible the syntax mistake was earlier in the document, but it will at least give you a good idea of where to start looking.
In addition to syntax checking, ColdFusion Builder also offers a debugging service. Click on the debug button in the toolbar to launch the file you are working on in your default browser and switch to the debugging perspective within ColdFusion Builder. From this perspective, you will be able to see a stack trace of the files being called in the request, current variable values, and breakpoints.
Breakpoints are useful for debugging your application. Instead of putting
cfabort tags within your code and then dumping out your variables, you can add a breakpoint to the code, which will halt processing at that point until you step forward. Once you have the information you need, you do not have to remove any tags and reload the page; you can simply tell the debugger to continue executing until the next breakpoint. From within the debug perspective, you will be able to see the current value of all the variables, and if necessary, update them with a new value prior to moving onto the next breakpoint. While going through the different breakpoints in your application, the browser will display all output that has been generated so far. Each time you proceed to the next breakpoint, the page content will update with the additional generated content. If you wish to stop debugging a page, it is important to remember to close the active debugging connection, as you can only have one connection per file. This can be done by either closing the browser window or clicking the ColdFusion template within the Debug panel and then clicking the terminate icon. Alternatively you can right-click the ColdFusion Template and select Terminate.
It is simple to add breakpoints. While in any perspective, move the cursor to the desired line and press Shift+Ctrl+B. Alternatively, choose Run > Toggle Breakpoint. If you wish to remove a breakpoint, toggle it again or choose Run > Remove All Breakpoints. During your debugging process, there may be breakpoints that you do not want the debugger to stop at for a certain run, but you may still not want to remove those breakpoints entirely. From within the debug perspective, you can deselect the breakpoints that you want to ignore from the Breakpoint panel. Only selected breakpoints will be used.
Before using the debugging features, you must first enable the line debugger from within the ColdFusion Administrator by selecting Allow Line Debugging under Debugger Settings. If you make a change to this setting, remember to restart the ColdFusion server before you start debugging. The debugging server within ColdFusion runs as its own service, so you can turn it on and off when needed and ColdFusion will still function. Just remember to turn it on prior to using the ColdFusion Builder debugging features.
This article has covered many of the basic features of ColdFusion Builder, but there are still many more features not covered here that will make your development of CFML faster and easier. Features such as ORM integration, Code Insight, and RDS Query Viewer offer significant advantages to developers. Keep an eye out for more articles and blog posts on these features. Open ColdFusion Builder yourself and take a look around–you might just have found your new favorite ColdFusion IDE.