Bean Markup Language, Part 2

Create event-driven applications with BML

1 2 3 Page 3
Page 3 of 3

Java's class loader interface makes it possible for programs to add new classes -- and thus, new behavior -- at runtime, even while the program is running. The ability to dynamically extend program functionality, combined with the metadata provided by the JavaBeans component model, results in an enormously flexible architectural toolset. Imagine an application wherein new functions and features could be added lazily, being loaded only when they were required. Not only would load time be amortized through the entire run of the application, but unused functions would never be loaded, decreasing the total load time and causing less drain on system resources.

The growing popularity of software component systems, such as JavaBeans, points toward the eventual disappearance of the application as a monolithic unit. Applications will operate as loosely coupled, dynamic associations of components assembled by a user, or even by another system, to perform a particular set of tasks. Such an approach to software systems has many benefits, including improved testability, dynamic upgrading, finer licensing granularity, quicker application startup times, extensibility, customizability, modularity, and eventually the development of a competitive component market. (Of course, those benefits bring with them challenges -- not least of which are component versioning and compatibility.)

Running the sample code

To run the sample programs, download the appropriate archive (in jar, tar, or zip format) from Resources below. Extract the files from the archive into a directory. (Because of some oddity that I haven't yet figured out, the jar file doesn't work properly in the classpath -- you have to extract it. Extra credit for anyone who can tell me what the problem is.)

I used the BML compiler to create a BML-free, reflection-free application in the file CFE.class. You can experiment with the application by simply extracting the files from the archive, setting the classpath to include ".", and running CFE as a main program:

$ java CFE

The application window should appear, and you'll have the running sample code. The second example, with JavaScript, won't run without the BML runtime, so I didn't provide a compiled version.

If you want to experiment with and modify the BML, you'll need to download the BML package and xml4j from alphaWorks (see the links in Resources.) Be sure the xml4j jar file (whose name depends on the release number), the jar file bmlall.jar and your current directory all appear in the classpath. Follow the instructions in the tutorial (included in the BML package) to get the BML player working, and then you can experiment with the sample BML from this article -- or write your own!


For the reasons outlined above, BML is one of the most exciting technologies I've experimented with. I urge anyone with an interest in XML and/or JavaBeans to consider experimenting with BML. BML may not change the world -- but something like it will in the near future. Remember, you heard it here first.

Mark Johnson has a BS in computer and electrical engineering from Purdue University (1986), and has been writing for JavaWorld since August 1997. By day, he works as a designer and developer for OrganicNet in Fort Collins, CO.

Learn more about this topic

  • Download the source code for this article:
  • Related JavaWorld resources
  • IBM BML and XML resources
  • The three great virtues of a programmer
  • According to Larry Wall, the creator of Perl (the second-best computer language in existence), the three great virtues of a programmer are laziness, impatience, and hubris. Read a description here

1 2 3 Page 3
Page 3 of 3