RAD Tool Let-down
Rapid application development tools let you put together a great-looking mock-up of your app in no time, but often are of little use for the production version of your system. Visual GUI builders and data-aware controls are two such culprits.
In yesterday’s post, I mentioned that all too often tools that help developers put out a really quick version of their application are frustrating to use when trying to create a sophisticated production version of the same application. This forces the developer to back-track and gives rise to the concept of the "throw-away" prototype, meaning that any effort put into the prototype has to be chalked up solely for the purpose of getting early feed-back but has to be tossed when it comes time to build the "real" system.
Today I'd like to illustrate what I mean with two very common examples of this phenomenon: visual GUI builders and data-aware controls. I have a love-hate relationship with them both.
By visual GUI builders, I mean WYSIWYG editors for laying out components in an application window. It's great to be able to sit down at a blank project and just start grabbing controls and laying them out on the screen, one after the other, changing positions if you change your mind about the layout, setting properties and seeing those properties immediately reflected in the representation of the window you are building. It is very satisfying to be able to put together a window so quickly, and it is much easier than instantiating all those widgets and setting their properties in code.
However, building the GUI through code does have some big advantages, and, personally, I almost never use a GUI builder for a production application. Here’s why. GUI builders give developers a component-by-component interface onto the window and treat properties as literal values. So, if I want to set the background color of a bunch of my components to red, I have to go and set the background color property of each of those components manually in the GUI builder. And, if I want to change the background color of all those components to something else, say orange, then I have to go through and change them all manually again. The GUI builder gives me a really quick way to put the window together but ends up with a pretty brittle design that requires lots of manual labor to make subsequent changes.
If, on the other hand, I set the background color of those properties in code, I can simply make a variable that represents the background color, set the color properties of those components to the variable, and then set the variable to red. It takes more time to set this up, and it’s a non-visual development process, but my design is now more flexible and I can change the background color of all those components by simply resetting the value of the variable to orange. This is exactly the benefit that Web apps get from CSS, and Joshua Marinacci posted a great article yesterday, CSS and Swing, about how you can achieve similar results to CSS in a Swing app by making a properties file that is read in at run-time. The problem, however, is that this takes you out of the GUI builder and into the code. I want a GUI builder that can handle this for me. Fortunately, many GUI builders generate source code which allows you to take a hybrid approach: use the GUI builder to generate basic component instantiations and properties, and then modify the generated code by hand from there. Still, I wish I didn't have to switch modes -- and that approach is generally a one-way street.
This problem can be more much sophisticated than just setting properties on components. I find that I often want to create bunches of components programmatically, with a loop, reading component specs from a database or config file or based on some algorithm. At that point, even a CSS mechanism can’t help me. I long for a GUL builder that can give me a visual environment to see what my window looks like at all times but to be able to create and manipulate components algorithmically as easily as I can create and manipulate them visually.
I feel similarly about data-aware controls. Manually wiring up GUI controls to database values is admittedly a pain, so data-aware controls are also a great boon in helping developers get a basic version of their app up and running quickly. However, I have rarely written a sophisticated data-driven app where I didn’t need to massage data while reading or writing from/to the database. Hard-wiring controls to the database tends to be pretty brittle. So, once again, for production-quality apps, I have to abandon the data-aware controls for a manual, code-intensive process that gives me the flexibility I need.
I would sorely love to have versions of these tools that can support the flexibility I need for production systems as well as the RAD capabilities I value for prototypes without having to backtrack and change gears along the way. Maybe such things exist, but I haven’t seen them.