Most Read This Week
Bearing Fruit with Plum
Review of the Plum IDE from Productivity Enhancement, Inc.
By: Jeff Fleitz
Feb. 11, 2005 12:00 AM
Plum stands for Practical Lightweight Universal Methodology, and consists of a comprehensive development environment that includes a Windows-based IDE; code generator; robust application framework; development methodology; simple integrated Content Management System (CMS); and stored procedure, unit test, and component generators. Plum accomplishes so much for a ColdFusion developer that it can literally be overwhelming trying to grok it all at first glance.
System Requirements and InstallationCFMX 6.1 is required to run Plum applications as the framework makes extensive use of ColdFusion Components (CFCs). The Plum IDE is a Windows .NET desktop application, so have the Microsoft .NET Framework 1.1 installed on your Windows 2000/XP computer prior to installation. Though the IDE is a Windows application, Plum-generated code can be deployed on any CFMX platform.
Plum was designed to work primarily with MS SQL Server 2000 (the stored procedure generator only supports this option), but will also support Oracle 9i and Microsoft Access 2000. If you are using Oracle you will need to download the Oracle .NET data provider to ensure that the IDE can read the database schema. (A future version of Plum is slated to support popular open source databases such as MySQL and PostgresSQL.)
Creating a ProjectThe New Project Wizard
Plum includes a new project wizard that steps you through the process of creating a fully functional baseline Web application in about two to five minutes.
The first steps collect and verify information about the operating environment, including application name, directory mappings, and server operating system. Once this information is collected the Plum Framework and starter content are installed.
The next several steps of the wizard verify a connection to your database and ensure that the mandatory Plum tables are present. Plum projects require the presence of five tables that support the Content Management and User Access modules of the application. If the tables are not present, they will be inserted, fully respecting the integrity of the objects already in the database. The remaining pages in the wizard collect and verify mappings for server, custom tag, and Verity collections, and allow you to optionally choose for which tables to generate standard maintenance forms.
At the completion of the project wizard, Plum launches your default browser and runs an initialization routine to verify your environment is set up correctly. At this point you can also optionally create Verity collections for your CMS starter content. When initialization is successfully completed, you are redirected to the home page of your new Web site, complete with starter content! Returning to the Plum IDE reveals a new project tree containing all the major components of your project.
The Generated Application
XML Project File
Working with the IDEThe main purpose of the Plum IDE is to synchronize your project with the schema of your database and rapidly generate code for your application. There is no WYSIWYG design surface or internal code editor; you will still be using your favorite code editor to manage code. The preferred editor is HomeSite+, and custom graphical tag editors are included to work with the generated code. However, it is relatively easy to re-create these tags in a custom tag library in Dreamweaver MX, if that is your preferred editing tool.
Round-trip editing is not supported; any manual changes made to the generated code are not subsequently reflected in the Plum project file. If you make custom changes to tag attributes in the code and you want to keep your project file up to date, you will have to manually update the attributes in the IDE. In fact, there comes a point in every Plum project when the generated code is "divorced" from the IDE, after which you might add your own handcrafted code. This is a necessary and intended behavior to allow you to extend the application with your own customizations.
The project tree contains four nodes that focus on the major code generation areas: environment, database, modules, and security. Clicking on a node in the tree activates the associated data input form for that node in the top right frame. The database and modules nodes and their children make liberal use of context menus, so it is a good idea to right-click on these nodes as you get started to view the available command options.
The environment node extends much of the required information gathered by the new project wizard, i.e., application name, directory mappings, data source connection, etc., by allowing you to specify variable settings for the SMTP mail server, Webmaster e-mail address, persistence preferences (session and/or cookie), minimum acceptable browser versions, enabling of error handlers, and whether or not to allow visitors to create their own accounts when visiting your site. All of the settings specified in this node are optionally written to the Environment.cfm file in the root of the application directory during code generation.
The database node expands downward two additional levels to include nodes for each of the tables in the database, and for the column and relationship attributes in each of the tables. Each table node allows you to specify the primary and alternate keys for each table as well as default singular and plural labels for framework references to the table in the application. Column nodes provide a form for specifying column labels, data type, default values, enumerated values, formatting functions, whether nulls are allowed, and finally, whether the value is issued by the database server or supplied by business logic. In the two latter instances, the column values can be displayed on forms, but input controls are not generated to prevent user input. Relations can also be created, but the database synchronization process handles this for you automatically. Relationships are already handled for you in most instances when Plum reads the database schema, but you can add or change relationships manually from the database node context menu. The settings in the database node are referenced by the IDE when building data pages.
The modules node is where you will spend most of your time in the IDE, building the forms for your application. Modules consist of pages (form containers) that are related by functionality, or similar security access restrictions. A page can contain multiple form types if desired. For instance, you can create a list form that also has an embedded search form on it, or an edit form which has a child list form on it (called a master-detail form), complete with built-in paging controls. Certain combinations are not allowed; you obviously can't have a child list on an add form, for instance. Pages can either be created individually, or you can have Plum generate standard or master/detail form sets for optionally selected tables at one time. It is quite a sight to see Plum generate all of the data maintenance forms for a module in just a few seconds! When you select a form on a page, a builder is presented in the top right frame that lets you choose the columns to be included in the form, as well as the control type and sort order for each column.
Building forms is an iterative process. Once you have a form built the way you think you want it, you generate the code for it and view it in your browser, come back into the IDE and tweak it some more, etc. At some point you may want to start placing your own handcrafted code into the page, or use one of Plum's custom tags that is not available in the IDE. This is the point at which you need to "divorce" the page from the IDE. Individual pages or entire modules can be locked down to avoid accidentally overwriting customizations.
The security node is where you create application roles and then assign users and modules to the role. Plum then generates the authentication code for each module. Roles are table driven, but not handled for you automatically. You will have to go into the User module on the admin side of your application and add each role code manually to the database.
Working Outside of the IDE
This comes in very handy when rapidly prototyping Plum applications that don't yet have a data model defined. The Plum Framework includes a component that creates sample data either programmatically or by retrieving data from text files. You can use this component to generate sample data in two ways: by using a QueryStub, which returns a query object based on passed data type parameters, or by using the sampleData attribute of the form and list-related tags. Prototyping in this fashion is like wireframing on steroids because all of the prototype code can be leveraged by simply changing the query calls.
If you are using MS SQL Server 2000 as your database server, you are in for a treat because you can have the Plum IDE create a complete set of insert, update, delete, list, and get stored procedures for you, one script for each designated table. These scripts are placed in the project's test directory, and can either be used as or as a starting point for further customization. While the stored procedures generated currently support single table operations only, and therefore won't work as is with some of the more complex Plum form types, this is still a very useful tool and an impressive feature for a 1.0 release.
You can further utilize the generated stored procedure scripts by having them converted to CFCs (ColdFusion Components) using the component generator. This tool encapsulates all of the stored procedures as methods calls in a component of the same name as the script, with a .cfc extension.
Unit testing is a popular practice in the OOP world, and involves designing and writing test cases which validate that class methods function properly and return valid outputs. The same principles can be applied to CFCs, although it can be a time-consuming and tedious process to write them yourself. The Plum IDE contains an internal facility that enables you to easily create and execute unit tests against your CFC methods. A series of dialogs allows you to visually build the tests, and the results are graphically displayed in your browser, along with the ability to drill down into the details of the result. This tool is useful if you plan on integrating additional components into the application.
The FrameworkThe Plum Framework comes with a core set of components, custom tags, and other supporting files that handle most of the heavy lifting required by all ColdFusion applications, including role-based security, data access and validation, structured exception handling, client/session management, browser detection, and layout management. An extensive, unencrypted custom tag library is provided to access the component methods. In fact, all of the code generated by the IDE consists of nothing more than custom tag calls (see Listing 1). There are so many custom tags and associated attributes available that using the provided tag editors is a must until you have spent some serious time using them (see Figure 2).
Content Management System
Automated Verity Management
Clean Separation of Data, Logic, and Presentation
Structured Exception Handling
<cf_Authorize roles="ADMIN,PUBLISHER" userMustBeAMemberOf="AnyOfTheseRoles">
Page sections can be restricted by using the cf_Authorize paired tag:
<cf_Authorize roles="ADMIN,PUBLISHER" userMustBeAMemberOf="AnyOfTheseRoles"> You will see me only if you're an ADMIN or a PUBLISHER. </cf_Authorize>
The Plum MethodologyThe Plum methodology takes a slightly different slant on system development that espouses quickness and simplicity. The Plum methodology is tightly coupled with the framework and is meant to help streamline Plum development with what is basically a 10-step process:
DeploymentIn dedicated host situations, the difference between a Plum application in a staging environment versus a production environment is the settings in the Environment.cfm file. So you should be able to upload your directory structure from the staging site to the production site, replacing the staging Environment.cfm file with one that has the correct values for the production server.
However, if you deploy the application to a shared host, there is a potential issue to contend with that involves custom tag mappings. CFMX cannot formally bind an instance of a custom tag to a particular application, so having multiple copies of the same tag name referenced in multiple custom tag paths results in CFMX not knowing which instance belongs with which application. To address this issue, Productivity Enhancement has provided a free utility called CF_2CFModule, which will convert all custom tag calls to CFMODULE="template" syntax, allowing the variable path reference to remain. To use CF_2CFMODULE, you simply drag and drop the root Plum project directory onto the CF_2CFMODULE.EXE icon, (after making a backup of course). You then deploy the converted directory.
Cut to the ChasePlum could be the Swiss Army Knife of the ColdFusion world. It does just about everything you need, and does it well?for free. That's right! Plum can be used for free if you don't mind looking at one small Productivity Enhancement advertisement in the bottom left corner of the IDE. If you adopt it, you will want to do yourself a favor and pay the $79.95 for a licensed version so you can sleep better at night.
While there are some areas that need improvement, it's an awesome product for a first release. Unfortunately for some, Plum performs most of its magic on Windows. If you develop on Windows, you owe it to yourself to check it out. If you are developing on another platform, you will have to pray for Mono.
For a complete list of Plum offerings, visit www.productivityenhancement.com/plum/WhatPlumCanDo.cfm.
Reader Feedback: Page 1 of 1
Subscribe to the World's Most Powerful Newsletters
Today's Top Reads