Posted on Jun 22nd 2010

All Spring Web Flow Editors are not created equal.  The purpose of this post is to outline some of the key differences between the Spring Web Flow Editors found in SpringIDE and MyEclipse for Spring.  I’ve also included some screenshots to further illustrate how working with a Flow Editor that is intuitive and feature-rich can make all the difference when developing applications with Spring Web Flow.

Spring Web Flow is a project from SpringSource for simplifying the development of web applications. While Spring Web Flow is compatible with Spring MVC, Spring Web Flow uses flows instead of controllers for implementing the web layer of an application. Since Spring Web Flow has functionality for managing application state, it is best suited for implementing the functionality where the activity being performed by the end-user spans multiple page requests, and all the pages need to be treated as a unit of work.

Flows are a group of related steps for accomplishing a task in an application.  For example, the checkout task of many online commerce systems consists of multiple related steps, including prompting for payment details, reviewing and choosing shipping options, confirming order, and optionally creating an account.  Some of the benefits of using Spring Web Flow are:

  1. XML-based flow definitions - The flow of the application is defined in XML. No custom Java is needed to implement a flow.
  2. Expression language support - An expression language lets you leverage logic from the other layers of the web application. Logic that a developer would typically put into a controller, that isn’t handled by Spring Web Flow, can be expressed in XML using the expression language.
  3. State management - Variables can be scoped (many scopes are supported), and Spring Web Flow will automatically handle the cleanup of those variables when they are out-of-scope.
  4. Modularization of flow logic - Flows can be re-used from other flows.

While this functionality could be implemented with Spring MVC, Spring Web Flow has features that make it considerably easier. However, in order to gain the benefits of Spring Web Flow, a developer needs to have a pretty in-depth knowledge of Spring and Spring Web Flow, and Spring Web Flow adds additional configuration requirements to a web application. While authoring the flow of an application using XML is elegant, implementing flows using XML can be difficult and tedious because without proper tooling it is hard to visualize the application flow from the XML.

MyEclipse for Spring reduces the complexity of adding Spring Web Flow support by automatically bootstrapping the project for you.  Furthermore, MyEclipse for Spring 8.6 introduces new scaffolding functionality that lets you generate full, ready-to-run Spring Web Flow applications from your domain model (i.e. database table, Java beans, or JPA entities).  Both bootstrapping and scaffolding are tremendous time savers, but MyEclipse for Spring also has a various development tools for authoring and editing Spring Web Flows.

Here are your flow editing options available in MyEclipse for Spring:

  1. XML Editor - Since flows are just plain XML files, you can use a standard XML editor for maintaining the flows, and MyEclipse for Spring includes an excellent XML editor.
  2. MyEclipse for Spring Flow Editor - An enterprise-class editor for authoring flows that provides a rich interface for graphically building the flows and includes content assist.  This editor is only available in MyEclipse for Spring.
  3. SpringSource Flow Editor - SpringSource also provides a basic flow editor as part of the SpringIDE, which is bundled with MyEclipse for Spring.

While the MyEclipse for Spring flow editor and the SpringSource flow editor have similar goals, there are some pretty major differences between the two editors, and the following table outlines some of the differences.

MyEclipse for Spring Flow Editor SpringSource Flow Editor
supports dynamic positioning of flow elements; positioning is persisted with diagram flow elements are auto-positioned (and not very well); elements can’t be repositioned
diagrams can be customized with color; typically different flow state types are colored differently color customization not supported
flow-level settings can be viewed and edited from diagram (i.e. security, inputs, outputs, variables, exceptions and flow-level actions) flow-level settings hidden and not editable
comments can be added to diagram using notes
comments not supported
full flow configuration is visible directly from flow diagram; easier to get full picture of flow functions and integrations with other layers of application most flow configuration is hidden; must use pop-up windows to see existing configuration
full flow configuration is editable directly from flow diagram; no distracting pop-up windows flow configuration must be done using modal pop-up windows
content assist; for easier configuration and integration; project-wide Spring artifacts are automatically listed content assist not supported
JSP pages automatically created for view states; easier hand-off from defining flows to implementing user interfaces JSP pages aren’t automatically created

To further show the differences, here are a set of screenshots of the MyEclipse for Spring Flow Editor and the SpringSource Flow Editor.  The first pair of screenshots show both editors editing a sample web flow from the swf-booking-mvc project that is included with the Spring Web Flow download.

MyEclipse for Spring - Flow Editor
booking-flow.xml
SpringSource - Flow Editor
booking-flow.xml

As you can see, the graphical editing experience is very different.  The MyEclipse for Spring editor shows you more configuration information about the flow (including flow-level settings), and it’s a lot easier to understand the flow of the application.  A developer can even print the diagram for communicating with business analysts or for creating development deliverables.  If you want enhance or reconfigure the flow, you can do it directly from the diagram.  If you would like to further enhance readability (but not necessarily change the behaviour of the flow itself), you can also re-organize the placement of the elements on diagram and/or add developer comments.

The previous flow is one of the most trivial flows that you can have, and the Flow Editor from MyEclipse for Spring provides a much richer flow editing experience.  When you are working with slightly more complex flows, the differences between editors becomes even more apparent.  The next set of screenshots shows both editors editing a non-trivial flow that was scaffolded (using MyEclipse for Spring 8.6) from a set of database tables.

MyEclipse for Spring - Flow Editor
managecustomers.xml
SpringSource - Flow Editor
managecustomers.xml

As you can see, the SpringSource Flow Editor doesn’t handle more complex flows very well.  The basic flow of the application is more difficult to read, and a lot of relevant configuration information is hidden from the developer.  On the other hand, the Flow Editor from MyEclipse for Spring provides a nice customizable layout of the flow and more configuration details.

The bottom line is that MyEclipse for Spring offers more intuitive, feature-rich tooling for Spring Web Flow development.  In addition to including the Flow Editor from SpringSource, all the enhanced Spring Web Flow tooling (bootstrapping, scaffolding, and an enhanced enterprise-class flow editor) is only available in MyEclipse for Spring.  MyEclipse for Spring also includes Code Assistants for maintaining the other Spring artifacts of a web application (i.e. Service, Component, Repository).

If you're interested in learning more about Spring Web Flow scaffolding, you may want to watch the following two screencasts:

There are two ways to get your hands on MyEclipse for Spring.  Existing MyEclipse Pro subscribers can use the add-on option in the Dashboard tab of the Software & Workspace Center, while new MyEclipse users can download a free, 30-day trial at http://bit.ly/asbbYo