Accessibility
 
 
Moving Up: ColdFusion to Macromedia Spectra

By Christina Lamkin
Senior Technical Writer
Macromedia, Inc.

Click here to read or download a PDF file of this article.

Macromedia Spectra dramatically expands the Web site function and management capabilities available to ColdFusion Web site developers and managers. Its content management, e-commerce, and customer management features are so extensive that most business enterprises completely redesign, plan, and build their Web site as a new system. They often reuse most of their ColdFusion code, but they do not attempt to merely add Macromedia Spectra code to accomplish the site upgrade.

Because Macromedia Spectra is entirely compatible with ColdFusion, it is possible to "get your feet wet" by replacing some ColdFusion code with Macromedia Spectra code in a Web site. Macromedia Spectra introduces new custom tags -- which you should code in new pages -- but the presence of Macromedia Spectra code does not affect the execution of other CFML code. Undertaking such a limited conversion is an opportunity to impose an ordered structure on your Web site design in anticipation of a full conversion to Macromedia Spectra.

Converting ColdFusion Elements

This technical brief addresses the prospect of converting selected elements of a ColdFusion Web site to Macromedia Spectra, and when and why this might be an acceptable alternative to rebuilding the full site in Macromedia Spectra. It provides a process for reviewing ColdFusion Web sites to determine which site elements are candidates for conversion to Macromedia Spectra entities.

But if you find that you want to implement more than one or two of the ideas presented here, then stop and reconsider: it would be more cost-effective and practical to plan on rebuilding the entire site in Macromedia Spectra. The Macromedia team does not recommend retrofitting an entire ColdFusion Web site by just adding Macromedia Spectra to it.

Here are some reasons to convert selected elements:
  • To improve Web site performance and make database access more flexible by replacing ColdFusion database queries with object methods
  • To improve efficiency, quality, and control over Web content management practices by modeling business processes with Macromedia Spectra workflows and process logic paths
  • To improve search capability and granular control of publishing rules by classification of content into a metadata hierarchy

This table shows some of the advantages that you get with Macromedia Spectra:

ColdFusion Macromedia Spectra
Database interactions accomplished with SQL query code in .cfm files; queries must specify data format Database interactions accomplished by calling Macromedia Spectra tags; interactions are independent of data format
Returned data is displayed or manipulated with code written specifically for each action Returned data is displayed or manipulated automatically with standard object method handler code
Entry, scheduling, and management of site content is minimally controlled and automated Entry, scheduling, and management of site content is controlled, structured, and automated
Code is reused by cutting and pasting into .cfm files; duplicated code is not controlled; code that calculates data values is interspersed with code that controls data presentation Code is reused by permitting multiple pages to call one instance of code; code is not duplicated; code that calculates data values is isolated from code that controls presentation

The following sections describe how to assess aspects of your Web site's structure and function.

Content Publishing Activities

Analyze Your Site

Analyze the means by which you publish content on your Web site. If you update content frequently -- on a fixed schedule -- this probably requires a lot of manual page coding. It may be difficult to keep up with the volume of information that you publish, and to maintain high quality, timely copy.

For example, a Web site page can display items such as:

  • The three most recent press releases from a company
  • The current day's headlines
  • Items on sale in the current week
  • Option menus, customized for categories of Web site visitors
  • Content personalized according to registered-user profiles
  • Banner ads, in rotation or by subject

The Macromedia Spectra Solution

To reduce the time required to manage custom content publishing or increase the efficacy of the publishing effort, you can revise your ColdFusion site to use Macromedia Spectra constructs: publish content objects into page containers according to publishing rules.

In this model, a content editor stores each unit of content as a Macromedia Spectra object, which is an instance of a content type. You define a type, such as PressRelease, NewsArticle, or ManagerMenu, and associate properties with each type, such as:

  • ReleaseTitle, ReleaseTeaser, ReleaseBody, ReleaseDateWritten
  • Item Number, Description, Photo, Color, Manufacturer, Size, Price

You define a region on a Web page as a container, with properties such as caching behavior, logging options, and error handling behavior. You establish publishing rules using criteria such as date, length of time, and category match, to permit Macromedia Spectra to dynamically populate the container with the appropriate content items when the page is requested. Publishing rules select the database content items to display in the container.

You can provide interfaces for content editors who perform any of these activities; typically, developers enable business users or managers to manage content objects, assign rules, and run reports using the Macromedia Spectra Anywhere Authoring features.

Macromedia Spectra makes it cost-effective to "test-drive" new content management strategies like these because you can use its versioning capabilities to quickly and reliably revert to earlier pages and files, and manage versions, or editions, of your Web site.

Where to Learn More

For more information on content management:

  • Designing Sites with Macromedia Spectra, Chapter 5
  • Managing Web Content with Macromedia Spectra, Chapters 1 and 2
  • Programming with Macromedia Spectra, Chapters 4, 13, and 15
  • Developers Center Web site
Multi-Participant Business Processes

Analyze Your Site

Determine whether the Web site supports business processes in which more than one person takes part, and in which some steps cannot be performed until earlier steps are completed. For example, if business users add content such as sales reports or news articles to the site which require drafting, revision, and managerial approval before publishing, the ColdFusion site can offer a form to create content, and perhaps a form in which a manager can indicate approval. The ColdFusion site can save the content item and the approval in a database, but it does not implement a mechanism for obtaining reviews or approval, or for notifying process participants when an action by them is required.

For another example, suppose a product manager adds item numbers to a database, a buyer adds an item description to each item, and a sales manager assigns unit and bulk-discount prices to each item. These processes require sequential control.

Inspect your ColdFusion code for data entry forms, approval forms, and e-mail notifications used in business processes. Review them with a business user to determine whether a Macromedia Spectra workflow would improve productivity and accuracy.

The Macromedia Spectra Solution

You can represent and enforce steps, approvals, and dependencies, and generate notifications to participants using Macromedia Spectra workflows. You define a set of task templates; then, selecting from the templates, you model a business process with a collection of tasks, associate business users with tasks, and set other options.

For example, a workflow in an online shopping catalog might be defined as follows:

Task Task Description Assigned to:
Create Catalog Item Copy Write item description text Copy writer - A. Fitzhugh
Create Catalog Item Artwork Insert and lay out product photographs Graphic Artist - L. Deming
Assign Catalog Item Price Insert price and discount Sales Manager - H. Cortez
Review/Approve Catalog Item Verify correct information Product Manager -T. Rose
Assign Catalog Item Start Determine when item appears in online catalog Sales Manager -H. Cortez

When the workflow is started, Macromedia Spectra notifies participants, in sequence, with an automated e-mail message, of the task they are assigned to complete. Participants can display task details on their personal home pages. When one participant completes a task, the next participant receives an e-mail.

You can specify whether to require the completion of a predecessor task before a task, or to allow tasks to be completed in parallel. Requiring the completion of a predecessor is useful when one task requires information that is generated in a predecessor. You can also specify a resultant content object, such as Catalog Item.

When business users log in to the Webtop, the scheduled tasks assigned to them display. A manager or other person with the appropriate permissions can display workflow status to view and manage open tasks.

Where to Learn More

For more information on defining and implementing workflows:

  • Getting Started with Macromedia Spectra, Chapter 9
  • Managing Web Content in Macromedia Spectra, Chapter 3
  • Programming with Macromedia Spectra, Chapter 20
Single-Participant Business Processes

Analyze Your Site

Determine whether the Web site supports complex business processes that:

  • Include conditional or branching activities to manipulate site content
  • Iterate over a set of data
  • Require only one participant

For example, suppose a business user creates product items several times per week for a ColdFusion Web site. All items have a set of standard properties, such as item number, but depending on the item type, other properties vary. The business user probably starts each new item the same way, then selects among several forms to complete the item information according to its type. Standard information must be entered before other information. The ColdFusion site can offer a form that has static-text instructions or warnings, but it does not implement a mechanism for branching, and it does not enforce sequence requirements.

The Macromedia Spectra Solution

You can represent and enforce sequential, conditional activities using Macromedia Spectra process logic paths (PLPs). You design a series of forms that guide a user through a procedure such as the one described previously, that would be more effectively managed by imposing a structured sequence on the user's activities.

A PLP definition specifies the process steps. You define a data object to contain data passed among steps. You code object handlers or a nested PLP that execute in sequence to accept and manipulate data. You can build in loops to repeat parts of the PLP. You can code the PLP wizard to vary its guidance according to the user's inputs, branching to dynamically determined steps.

PLPs maintain state information and save their data in a database, so the process can be rolled back from any step to a previous state. This is a critical requirement of e-commerce applications.

Where to Learn More

For more information on PLPs:

  • Managing Web Content in Macromedia Spectra, Chapter 1
  • Programming with Macromedia Spectra, Chapter 19
Content Categorization

Analyze Your Site

Review the site logic for content searches or content listings by category that users can request. For example, the site may let Web site users enter a department code to display a list of its employees' phone numbers; or enter selection criteria to generate a list of products from a catalog. Typically, this kind of information is stored in legacy databases that are also accessed by other applications, so it is not possible to develop an optimized database for exclusive use by ColdFusion. The searches or requests available to users are limited to those for which detailed database queries have been coded.

If the performance of these functions is not satisfactory, incorporating Macromedia Spectra metadata functions can address the problem.

The Macromedia Spectra Solution

Site metadata is a set of categories and keywords that classify site content. The classifications are used in searches. This system of abstracting information about site content enables, for example, a sports portal Web site to display a dynamically generated list of current headlines about a user's favorite pro sports franchise on the user's home page.

You implement metadata functions as follows:

  1. Research and design a metadata hierarchy-a set of detailed categories and sub-categories that fully describe the site's content.
  2. Create the metadata hierarchy in Macromedia Spectra, and enter categories and keywords into it, using code or the Webtop Metadata Picker.
  3. Assign keywords and categories to each content object.
  4. Optionally, associate content object types with a metadata hierarchy.
  5. Code method handlers that perform operations such as search and sort against site content, and call the handlers from the appropriate site pages.

Where to Learn More

  • Managing Web Content with Macromedia Spectra, Chapter 4
  • Programming with Macromedia Spectra, Chapter 18
Caching Policies

Analyze Your Site

Caching, in the context of Web site operation, is the temporary storage of static data in client or server memory so that the data can be retrieved more quickly than if it were retrieved from its permanent location. Caching is applied to data that is not updated for at least as long as the cache period. For example, if your site includes a complex form page, which the system tends to render slowly, you cache the form so that when a user opens it, it appears quickly, and the user can begin entering data into it immediately. Because the form itself is rarely updated, there is little chance that a user would be served an outdated version of it.

Another example would be a news portal site to which content is added twice per hour. You could implement 20-minute content caching so that news stories would be rendered quickly, and you would refresh the cache from the news database on a schedule that is in sync with the addition of new stories. You could implement longer-term caching for the page header and navigation menus.

On a ColdFusion Web site, you can configure a limited set of caching options, and the only site element that can be cached is the static HTML returned from the execution of a ColdFusion page. You cannot implement complex caching, such as would be required for the examples.

Review the structure of your site and analyze performance logs to determine which elements are candidates for caching in Macromedia Spectra. To perform a good analysis, you must have a complete, accurate model that specifies the Web site structure.

The Macromedia Spectra Solution

On a Macromedia Spectra Web site, you can configure an extensive set of caching options, and you can apply them to the entire Web site, sections of the site, pages, containers, and content objects.

These options let you optimize your Web site more effectively and with more granularity than you can with ColdFusion. For example, with Macromedia Spectra caching, if your site's My Home Page is composed of several containers, each of which displays a number of objects, you might cache these containers:

  • My Favorite Bookmarks, for the length of the session, unless the user updates it
  • Recent Movie and Video Releases, for three days
  • Local Weather, for fifteen minutes

When traffic to the page is heavy, these elements would be quickly accessed from memory. Another container, such as Stock Market Ticker, would not be cached at all; it would be dynamically generated so that moment-to-moment changes would display at each page access. This setup would permit the page to be rendered quickly, so the user could view some elements immediately on the page, while other elements appear after a few seconds.

In Macromedia Spectra, you can specify caching options and attributes by writing tag code or by using the Webtop GUI interface.

Where to Learn More

For more information on configuring caching:

Content Version Control

Analyze Your Site

Review the way you store and manage content versions or backup copies on your Web site. Evaluate whether your system effectively performs functions such as:

  • Archiving versions of files. Examples: Daily Web site metrics; a dynamically generated list of top sellers that is updated frequently; comparative sales data
  • Roll back to an earlier version of a content object. Example: After displaying an item for sale at one price, the Web site displays it at a sale price; department managers can access price histories
  • Access any version of a content object. Example: A columnist enters several weekly columns at once through a browser interface. The columns appear on the Web site on schedule, one column per week. Readers can retrieve past weeks' columns.

The Macromedia Spectra Solution

Macromedia Spectra implements content version control by making copies of content objects in the content object database. Each instance contains an embedded content object of type VersionInfo. VersionInfo properties store the instance's version number, data source, and type, and pointers to the other instances of the object. You code method handlers that select the appropriate version according to values of these properties.

Where to Learn More

For more information on versioning:

  • Programming with Macromedia Spectra, Chapter 15
  • Designing Sites With Macromedia Spectra, Chapter 2
Content Syndication

Analyze Your Site

Determine whether your site adequately supports inbound and outbound syndication-incorporation of content from other sites, and provision of content to other sites, respectively.

Determine whether content syndication is effectively performed on your Web site. Does it:

  • Exchange dynamic site content with affiliate sites on a scheduled or ad-hoc basis
  • Accept explicit requests from a remote site for dynamic content
  • Import content from remote sites

For example, a shopping site can offer several items from each of the retail sites whose catalogs it represents. The retail sites select new items each week, which appear in the appropriate categories and search results on the catalog site.

The Macromedia Spectra Solution

Macromedia Spectra supports inbound and outbound content syndication:

  • Outbound syndication is accomplished using containers and rules. To continue the previous example, a retail site publishes item photos, prices, and descriptions into containers, to which it grants the shopping site access under the control of a publishing rule that displays each item for one week.
  • Inbound syndication is accomplished using syndication streams and handlers. To continue the previous example, the shopping site integrates the current content from each retail site into its site, displaying the aggregate collection of items.

In this example, the retail sites can generate HTML output for the shopping site; this content is displayed as-is by the catalog site. To enable the catalog site to reprocess the content, the retail site formats XML content as Web Distributed Data Exchange (WDDX).

To transfer updated content, the retail site developers code scheduled server push functions to deliver content, or the shopping site developers code scheduled client pull functions to make content requests. Content is transmitted through FTP, e-mail, or HTTP protocols.

You can implement syndication so that you add and remove site affiliates, maintaining a user list and specifying the access rights of each user, or you can code support for subscribe mode, to permit users to add and remove themselves as affiliates.

Where to Learn More

For more information on syndication:

  1. Managing Web Content with Macromedia Spectra, Chapter 6
  2. Programming with Macromedia Spectra, Chapter 14
Tips: Integrating Macromedia Spectra Into the ColdFusion Development Environment

If you decide to implement Macromedia Spectra functionality in a ColdFusion production environment, use these guidelines:

  1. Review the system requirements in Installing Macromedia Spectra and the configuration information in Administering Macromedia Spectra to determine whether your operating platform supports Macromedia Spectra.
  2. Before installing Macromedia Spectra, make a copy of the production environment and development environments.
  3. Store Macromedia Spectra pages in separate files and directories from ColdFusion pages.
  4. Configure your external databases as Macromedia Spectra datasources.
  5. Refer to technical papers on the Developers' Exchange Web site, such as: