One of the most important but least used techniques in software development is proper design before implementation. Everyone knows this, but it seems that no one does it. Insane development schedules, pointy-haired manager types who believe that the only "real" artifact produced by a developer is source code, and a host of other events conspire to keep development as a nonengineering pursuit. However, those who have used good design (in the form of use cases, sequence diagrams, class diagrams, and so on) find that it reduces the number of required changes late in the project, calls for fewer design changes after coding has started, and shortens development schedules.
The tool that's generally considered the Rolls Royce of CASE (Computer Assisted Software Engineering) is Rational Rose. It's the market leader and has a well-established reputation for supporting large-scale development projects. In fact, the "three amigos" who created the UML (Unified Modeling Language), Booch, Rumbaugh, and Jacobson, all work for Rational. Rose supports not only diagrams and other design artifacts, it also includes code generators to realize its diagrams in source code. It comes with built-in support for C++, Java, Visual Basic, SQL, and a few other languages. Alas, the Java code generation within Rose is a bit weak. It will generate classes based on diagrams, but its capabilities are very rudimentary. Of course, it would be nice if Rational directly supported JBuilder. This is the gap that Ensemble's Rose JBuilder Link seeks to fill.
Before talking about the product, however, a bit of background on RoseLink extensions is in order. Rose has extensive support for third-party add-ins. This may include code generators, version control packages, or anything else that developers might want to access from within Rose. In fact, an entire category of add-ins called Links exists just for code generation from models.
Basically three types of links can be created:
This brings us to Ensemble's Rose JBuilder Link, a full round-trip link with synchronization. To use it, you must have Rational Rose installed. It currently supports Rose 98, 98i, and 2000. Note that it won't work without Rose; it's written as an add-in tool so there's no standalone version, which is typical of Rose links. It's a standard InstallShield installation, actually a series of linked installs, each automatically following the other. So when you install it, you'll get a bunch of installation notices flying by. However, it's completely painless.
- forward engineering: Takes model diagrams and produces source code. However, once the code has been produced, the link has nothing more to do with it.
- reverse engineering: Takes source code and produces models from it, showing all the relationships from the code in the diagrams. However, it can't take the resulting models and generate source code.
- round-trip: Performs both of the above tasks - it can generate code from the model and vice-versa. The best round- trip links will make sure the code is synchronized, so the user canmake changes in both the model and the code, then
synchronize the changes. Obviously, the last type of link is the most powerful and therefore the most desirable (and not surprisingly, the most difficult to write).
The next time you run Rose, you'll see a menu item under Tools for Ensemble Tools. The first time you run it, it will ask for a license. It looks like they've started using the same type of licensing arrangement that Rose uses, either a single license or a floating license. I'm less than enthusiastic about the way the licensing works in Rose (and consequently in Rose JBuilder Link), but I suppose it's a necessary evil. One of the options presented in the licensing manager is for a trial license, which lasts 30 days. This allows you to download a copy from their web site and put it through its paces for a month. There's one quirk that's a side effect of the licensing. When it generates a license, it looks at the network characteristics of your machine.
I installed it while I was connected to the Internet via a dial-up connection and everything worked great. However, I tried to run it later when I wasn't dialed into the Internet and it refused to run because the license couldn't identify my machine. As soon as I logged back onto the Internet, the 30-day license reappeared. What's worse, when I went back into the office and could connect through the Internet using the office LAN, it still couldn't see the license. The only way I could use the license was if I were connected to the Internet in exactly the way I was when the license was generated.
Sigh. Maybe someday tools that are paranoid about licensing will get it absolutely right. For now, it generates minor inconveniences. I can't begrudge software vendors worrying about licensing and pirated software, but it's less than optimal if it gets in the way of legitimate use. The moral: before you run Rose JBuilder Link the first time and generate the license, make sure you're connected to the outside world in the way you'll be when you're working. I don't know if this same problem manifests itself with a "real" license. If it does, it's a serious shortcoming because it wouldn't allow me to use Rose JBuilder Link when I'm away from the office. After talking to Ensemble tech support, they assured me that this is a known, intermittent problem solely with laptops, and it only affects the trial version. They also stated that they are working on a solution.
I ran Rose JBuilder Link on a 650MHz Pentium III laptop with Windows 2000 and 256MB of memory. However, it takes up fewer resources than Rose itself, and most of its work is done with file generation; thus the I/O subsystem on your machine makes more difference than the processor. The bottom line: if your machine will run Rose, it should run Rose JBuilder Link with no problem. And if your machine runs JBuilder, you have more than enough machine to run just about anything else!
As far as the tool itself, it does an impressive job. As a stress test, I took a fairly complex JBuilder project and used Rose JBuilder Link to reverse engineer it to get class diagrams. The UI link has an intuitive user interface, showing the Rose model in an outline on the left and the JBuilder project on the right as seen in Figure 1.
Rose JBuilder Link reverse engineered the project flawlessly. When it was done, I had an object model based on the project. And it doesn't just pull the objects into Rose and create Rose references to them. It also establishes the relationships between the classes - those within the project and those that are part of the Java libraries. For example, Figure 2 shows a couple of the resulting classes that it created.
As you can see, both the CustomerFrame and PartsFrame classes use the DbPanel JavaBean for user interface chores. The class diagram correctly links these classes together with a dependency arrow. Also, the InvalidBalanceException class subclasses the built-in Java Exception class, which is shown by the generalization arrow. You'll notice that all the other classes also use the Exception class because it's thrown by JBuilder's jbInit() method. This diagram would have taken a long time to create by hand, given the complexity of the application.
Rose JBuilder Link will also take class diagrams and generate source code from them. I tested this with a fairly complex set of class diagrams that my company had created for a client. Rose JBuilder Link did a good job of generating the classes and creating stub implementations for them. It will also correct syntactic errors in the model that don't conform to Java rules.
For example, a class description in the model incorrectly (from a Java standpoint) declared an array. Rose JBuilder Link corrected the problem as it generated the code. This goes above and beyond the call of duty! When Rose JBuilder Link generates code, it doesn't place "magic markers" in it. A lot of code generators do place markers in the code that can't be removed by the developer without "breaking" the reverse engineering of the code. Rose JBuilder Link handles this by placing model documentation as code comments rather than brittle "magic markers."
Once you have both a model and a project side by side, you can refresh the views and Rose JBuilder Link will highlight the differences between the model and the code. This is nice in situations where the model and the code have changed simultaneously. Within its user interface, you can see exactly what's changed in each. Once you've decided which "side" (the model or the project) needs to be updated, use the button on the bottom to handle the update for you. All in all, the user interface is intuitive and useful.
Rose JBuilder Link also includes some other tools to make JBuilder and Java development easier. One of the hassles of doing Java object modeling in Rose is the clunky user interface you must use to see attributes of classes, such as scoping and modifiers. Because Rose must support many languages, the language-specific elements are confined to a single customizable dialog box. One of the nice little tools that Rose JBuilder Link includes is an editor that allows you to set these characteristics without going through Rose's constrained dialog. This Class Editor tool is shown in Figure 3.
Rose JBuilder Link includes several other tools that space won't allow me to write about, including tools to help support server-side development such as Enterprise JavaBeans. In general, I think this is an excellent product, and it shows just how far code generation and reverse engineering have come. If you need to use Rose for object modeling (you really should be using something!), Rose JBuilder Link is a welcome time- and sanity-saving addition.
Neal Ford, vice president of technology at the DSW Group, is also the designer and developer of applications, instructional materials, magazine articles, and video presentations. [email protected]