Review of Rational XDE (Extended Development Environment)
(XDE是闻名已久素未谋面的开发工具了。今天居然在theserverside看到一篇关于XDE的review,转贴出来,与同好共飨。)
As an experienced architect and software developer, but a relatively new user of Rational XDE, I thought that other engineers might gain some insight through what I have learned about this tool through use. First I’ll state that my perspective is primarily as an architect. I do implement my own architecture and design decisions, as I believe all good architects should, but I won’t be focusing on the programming features of XDE as if to imply that XDE is merely another programmer’s IDE. What I am definitely looking at is how XDE can help a team to produce rock solid software models and code, while using as few gestures as possible. As a consultant, I have seen over the past four years the multitude of time-and-materials contracts dwindle, and steadily be replaced by fixed-bid contracts. Generally, fine-tuned fixed bid deals make buyers feel comfortable while causing implementers to worry. Nonetheless, as a technical advisor to our executive management, it’s my job to find ways to embrace a changing marketplace and make 35% or higher profit on such opportunities. For me such an effort includes finding better ways to integrate with complex third-party enterprise tools such as content management systems, and more proficient ways of creating custom add on features to our own aerospace industry enterprise authoring and publishing system. I believe that many others are in the same boat, and will appreciate looking at the software development solution space from this perspective. So that’s my angle on Rational XDE. Even if I am not precisely addressing your team’s issues, you can probably find some ways to apply what I discuss. I’ll first introduce you to the project I have used to base my analysis on and some high-level concepts around emerging software modeling standards that have caught my attention. Next, I’ll drill down a bit by reviewing some of the features introduced with XDE. I’ll talk about my own productivity with the tool as well as some of the problems I encountered. Finally I wrap things up with a discussion on pricing and availability. My Project =========== One of our major issues is in supporting our aerospace industry authors with a sufficiently rich GUI, while keeping them up to date with our latest product releases. As I see it, a perfect balance could be struck by delivering rich GUI components to the client from an enterprise server interface. Along with Droplets, I am investigating the potential of using the Java- and XML-based Thinlet (www.thinlet.com) toolkit along with an invented-here server-side solution to fetch and serve rich GUI components, and dispatch client-side requests to server-side controllers. The idea is to end up with the best of rich and Web GUI worlds. Trievelet is what I call my Thinlet server, which works through either EJB or straight RMI. I’ve used Rational XDE as the modeling tool and development environment for the Trievelet project, so I can evaluate several tools and technologies at once. Background =========== The thought of “the model is the code” has intrigued me for close to two years now. I had been following the JSR-26 “UML for EJB” efforts, and I had an opportunity to write for JDJ on the subject. In researching JSR-26 I learned that, while useful in its own right, in the larger scheme of things it will likely have a supporting rather than a leading role. As a specification for capturing EJB design artifacts, it allows tool vendors to adhere to a set of UML stereotypes, tagged values, and constraints that promote the delivery of standards based models that accompany broad market enterprise components. The specification also defines how the inter-cooperation of various tools must take place using a common model format, namely XMI. That’s reasonable and useful, with JSR-26 taking center stage. But JSR-26 captures less of the spotlight in playing another role. MDA (Model Driven Architecture) facilitates the abstraction of the software model away from concrete target platform (such as J2EE/EJB or .NET). Once the model is completed, the modeling tool is used to send the abstract model through the code generation engine while applying a transformation that couples the software system to the target platform. This is possible through the use of something called UML profiles, a powerful foundation element of extensible UML tools (http://www.omg.org/mda/specs.htm). JSR-26 specifies an EJB profile. (Actually the EJB profile itself rests on top of a Java profile that is used for modeling J2SE applications.) There’s an MDA-level profile to add to the top of the stack. The OMG has defined one such UML profile named EDOC (Enterprise Distributed Object Computing; http://cgi.omg.org/docs/ptc/02-02-05.pdf). With EDOC, after you have injected your application model into a J2EE/EJB platform (using what JSR-26 defines), then you may also inject it into a CORBA™ and/or .NET™ platform (see Figure 1) using respective profiles. This implies that if you use a UML modeling tool that is not based on UML profiles, you may have thrown your money at an eventual dead end solution. MDA is a pretty heady goal, so much so that some developers who frequent this site doubt MDA entirely. For sure a lot of R&D must take place before full-fledged MDA is a reality. For example, the Action Semantics specification or another solution must be provided to fill in the 20%-40% of the software solution that cannot be modeled, but must currently be hand coded. The model must be readily debuggable, just like Java and other languages we use today. I haven’t found a silver bullet in Rational XDE, but I am sort of backing my way into MDA today through what it provides. Figure 1 –Model Driven Architecture as applied to enterprise application deployment on three popular platforms. For me, a key feature of any tool that claims to support MDA is that it facilitates rapid development. I know that my company will not immediately leap into EDOC-based MDA development, but I do see us taking a phased approach to MDA. Following success on the first front, I can well imagine eventually taking higher steps up the abstraction ladder by creating models that can be injected into multiple platforms. Given a phased approach to MDA, it appears that Rational XDE can help us now, and be there if and when full MDA becomes reality. Next, let me introduce you to Rational XDE from high altitude, then we will dive into some powerful MDA tools that comprise it. Rational XDE Is Open ====================== Rational Software uses IBM’s open Eclipse IDE as a container for XDE’s modeling and code authoring and management tools. I’ve been using this tool to model and code, and I like it. I hate IDE wars, so please accept this as my personal opinion. XDE supports the open Reusable Asset Specification (RAS) standard for software model component exchange and reuse. It hosts the UML open standard for object-oriented software modeling, and XDE’s UML tools are based on years of Rational UML experience and development. It also provides data modeling tools. Figure 2 provides a view of the Rational XDE GUI and a use case diagram I was working on. You may be able to see that I added business model interactions under each use case in the left-hand tree view. Figure 2 – The Rational XDE graphical user interface based on IBM’s Eclipse. What’s new about the modeling experience of Rational XDE is its support for non-UML shape, free form modeling. Rational Software did extensive research into why more developers don’t naturally migrate to software modeling. They found out that many developers just use ad hoc tools, such as Visio or Word, to create loose representations of software architectures and designs. They also found that, while UML aficionados express their models quite well in UML, those “unlettered” in UML may need a different medium to understand software blueprints. So, to open XDE to a broader segment of developers and model participants, Rational XDE provides free form modeling support. Generic shapes can be intermingled with standards-based UML. While the purists might cry foul, I suggest that less experienced developers may appreciate it as “baby steps to UML,” and non-technical project stakeholders as tech-babel visors. If you are questioning the value of software modeling, this feature of Rational XDE might sway your opinion. The XDE license is open. What I mean by that is, if you are familiar with the node-locked and other stringent licensing mechanisms long associated with Rational Rose and other top shelf modeling tools, you will appreciate that it is missing in Rational XDE. You may install Rational XDE on as many workstations as you, and you alone, will use XDE on. I personally use XDE on my office workstation, my home desktop and my laptop. Productivity with Rational XDE ================================ While software modeling is at the core of XDE, I have found it to be a general productivity enhancing development tool. XDE delivers code from software models without a hitch. For example, you can right-click on a model element such as a class targeted for Java implementation, and select the Generate Code option. Other neighboring options include Reverse Engineer and Synchronize. The Generate Code and Reverse Engineer options support the older roundtrip engineering techniques. But the Synchronize code option allows you to immediately see changes to your model reflected in the code, and direct changes to the code reflected in the model. The XDE toolbar contains a toggle button named “Enable/Disable Autosync Mode” that serves as a global setting. Once you save changes to a class it is automatically compiled. Errors are highlighted immediately, and mouse hovering reveals the error. Multiple diagrams and source code edit windows are managed by a tab control. You may rearrange the XDE GUI using docking windows. I’ve basically stuck with the default layout. Delivered up as an Eclipse “perspective,” Rational XDE Help got me up and running pretty rapidly. I believe that the UML isn’t that difficult to master. But it can sure seem that way when it’s presented as a dry, academic exercise for the “upper crust” of software professionals. I discerned that the Rational XDE Help content completely avoids a pedantic approach, but instead “upgrades” its prose to an extensively tutorial approach, which I personally appreciate when it comes to learning a new tool. Like me, once you are past the basics of XDE, you’ll be ready for the advanced topics found on the Rational Developer Network (http://www.rational.net). Every copy of Rational XDE also includes a copy of the Rational Unified Process, or RUP. Teams that choose Rational XDE for their primary development tool can use RUP’s use case driven approach to software development. Rational XDE’s RUP tool includes guidance through all four phases of the software development lifecycle (at least according to RUP): inception, elaboration, construction, and transition, and it includes full templates for artifact creation. With the surging popularity of Extreme Programming, not surprisingly, there is now a RUP XP Plug-in available from Rational Software. These specific features have helped me be more productive than using separate modeling, coding, and build tools. Code Templates and Patterns ============================= Again, while the full “model is the code” MDA product is not what I can use today, here are some tools that I have found to be very powerful. And, yes, they do qualify as true MDA solutions. Code Templates ----------------- Code templates increase the power of Rational XDE by allowing users to generate more code from Rational XDE models. This speaks to the need to close the gap between code skeletons generated from models, and true self-supporting, reusable software assets that can be injected into other model-based development projects for which they were not originally created. In a nutshell, code templates contain snippets of code written in the target language, such as Java, and scripting code, such as JavaScript, that gets executed dynamically when the code template is applied to a modeling element such as a method. The code snippets get injected directly into the targeted method, while the scripting code generates code dynamically based on parameters that are passed to the template. Here’s an example of a simple code template that I wrote: System.out.println(<%= param1 %>); This code template, when applied to a method, creates code that prints a message out to the standard output file. The actual message string that prints is determined by the parameter that is passed to the code template when the template is bound to the target method. The JavaScript runs over the code template and inserts the value of the passed param1 into the area between the <%= and %> directives. Anyone who has done JSP development will be very comfortable with creating code templates using JavaScript. I created a class model element named MessagePrinter, which may contain any number of class (static) methods that print string messages to the standard output file. To start with, I defined just one such method named sayHello(). Figure 3 shows what the class looks like in the model: Figure 3 – The MessagePrinter class as a model element in a diagram. Here’s what the class looked like as a mere skeleton before binding in a code template: public class MessagePrinter { private static final String helloMsg = "hello, world"; public void sayHello() { } } Next I applied my simple code template to the sayHello() method by binding it. I provide the class variable named helloMsg as the only parameter to the code template. Here’s what happened: public class MessagePrinter { private static final String helloMsg = "hello, world"; public void sayHello() { /*Begin Template Expansion{C8D533EB-C455-11D6-B428-005004ACEC42}*/ System.out.println(helloMsg); /*End Template Expansion{C8D533EB-C455-11D6-B428-005004ACEC42}*/ } } As you can see the sayHello() method body now contains an implementation based on the code template that was applied to it. While this is not a very meaningful code template, it requires little imagination to think of the ways that code templates can benefit a project. Patterns ------------ Rational XDE patterns are based on parameterized UML collaborations, or structured relationships and behaviors that can be applied to general software design situations. Rational XDE patterns provide model-to-model expansions while code templates provide model-to-code expansions for use by code generators. For example, if you use Rational XDE you may never have to write a singleton ever again. All you will do is follow these easy steps: 1. Create a class element in your model 2. Right-click on the class element in a diagram or in the project tree 3. Select the “Apply Favorite Pattern” cascading menu from the popup context menu 4. Select the “(GOF Patterns) Singleton” option 5. Fill out a few panels in a dialog-based wizard that pops up and click Finish The class you just created is now a bulletproof singleton, complete with a private static single instance variable, a private constructor, and a public classifier method named getUniqueInstance(). Now all you have to do is provide the business methods that support the singleton instance manipulation and services, which in fact may be supplied by applying more design patterns or some preexisting code templates to the class. The following is the generated code: /** The Singleton defines an Instance operation that lets clients access its unique instance. It may be responsible for creating its own unique instance. * @modelguid {C8D53458-C455-11D6-B428-005004ACEC42} */ public class DocIndexer { /** This attribute stores the instance of the Singleton class. * @modelguid {C8D534B7-C455-11D6-B428-005004ACEC42} */ private static DocIndexer uniqueInstance; /** This operation implements the logic for returning the same instance of the Singleton pattern. * @modelguid {C8D534BA-C455-11D6-B428-005004ACEC42} */ public static DocIndexer getUniqueInstance() { /*Begin Template Expansion*/ // TO DO: You can customize the operation // based on your application needs. if (uniqueInstance == null) { uniqueInstance = new DocIndexer(); } return uniqueInstance; /*End Template Expansion*/ } /** @modelguid {C8D534BE-C455-11D6-B428-005004ACEC42} */ private DocIndexer() { } } Figure 4 shows the generated classes in a diagram, including a sample singleton client class.
Figure 4 – A diagram showing a singleton generated by applying the GoF Singleton pattern to an existing class model element. Many of you might be thinking, ‘I can write a singleton in my sleep!’ As proficient as many of us might be at coding patterns into a given domain, how about the college intern working down the hall? Truly even many middle-level programmers can struggle to understand even why a singleton is needed, let alone how to write one properly. Project leads can leverage both productivity and quality gains by instructing developers to apply Rational XDE patterns to their code. Further, even though you may be able to write a singleton ‘in your sleep,’ why would you want to write one again and again while you are awake? What is more, how well can you implement the Visitor pattern, or the State pattern? >From my viewpoint I want developers, me included, to have all the tools available to accelerate the development and increase quality of software that is deployed in exchange for money. Rational XDE ships with a complete compliment of GoF Patterns. The Rational XDE Professional Java Edition also ships with a set of J2EE Patterns. The J2EE patterns come in the J2EE 1.2 and 1.3 varieties, supporting the various versions that developers might be using. The J2EE 1.3 patterns include common ones such as local and remote BMP and CMP entity beans, local and remote stateful and stateless session beans, message-driven beans, HTTP servlet, and others. Creating Your Own Reusable Assets =================================== One of the greatest strengths behind the Rational XDE is not just the patterns that ship with the product, but the ability to create your own software assets based on RAS. You have the power to build both code templates and patterns that dynamically generate parameterized code. Your own reusable assets might be created in support of in-house development efforts, such as for consulting practices that produce similar solutions around integrated COTS components of various kinds. You might also go into the market of providing reusable assets for vertical industries. However you may decide to use reusable assets, harvesting pre-built solutions into model and code artifacts that can be applied to unique problem domains time and again and can increase your deployed software’s quality and help you turn a profit in several different ways. I am creating reusable assets for the Trievelet framework. Trievelet reusable assets include patterns with code templates that simplify the creation of server-side XML GUI descriptors and their associated controllers. Along with reusable assets shipped with XDE, such as EJB-related patterns, development of server-side controllers that make use of EJB business components is a rapid process. However, I believe that the real payoff will come when we have our business components captured into code templates and patterns. Once a new GUI is finally built, major GUI changes occur from time to time, but customers are always seeking new features that require new enterprise server components. A reasonable goal is to create reusable assets around our product components as well as common components that we use all the time outside of the aerospace industry. Installation and Usage ======================== Starting from installation and advancing to usage, this is what I found. The installation threw me a bit. The check boxes on the ‘what to install’ panel contained checkmarks on both Standalone Rational XDE and for use with the IBM WebSphere Studio Workbench (WSSW) environment. I tried to uncheck the WSSW option so I would get the standalone version, but couldn’t. Instead I inadvertently selected WSSW and clicked Next but was denied since I do not own WSSW. I soon realized that the check marks represented what I could install, not what I was going to install. Since it tricked me twice in one month on two separate installations, I would suggest making this setup feature a little more intuitive. After installation I immediately started the program. I was presented with a dialog box that suggested that I create a new project. Being offered the opportunity to create a “Model” project or a “Java” project, I had little idea what to choose. It seemed fair that I wanted to create both, but that was not a choice. If I created a “Model” project, would I be able to generate Java code from it? If I chose the “Java” project, would I be left with a model that was frozen forever in Java space? Well, as I found out later, you will eventually create both and place both in a workspace. A workspace can contain multiple projects. First you could create a “Model” project and perform your early analysis and architectural design. Later (or sooner) you create a “Java” project and place it in the same workspace. This is when the rubber meets the road and your model gets generated as Java code into the Java model. Of course I should have read the “Welcome” page staring me in the face, but I didn’t until later. Since I’m not certain if this was my problem or Rational’s I only suggest that they might want to add some help text to the project creation dialog box. Once I figured out that I should create a model project, I created a very simple use case diagram straight away (see Figure 2). Just for fun I started hovering my mouse over toolbar options. I noticed the “Arrange all elements” tool and decided to click it. It did to my diagram exactly the opposite of what the feature name implied. Rather than snapping shapes into uniform rollcall formation, it turned my simple use case diagram into a complex use case diagram; however, a simple Edit/Undo easily fixed the problem. At first it appeared that if I wanted to view Help that I could not do so and work on my software model at the same time. This may have more to do with Eclipse “perspectives” than it does with Rational XDE, but I am not sure since I have little experience with Eclipse. Basically, to fix the “problem” you only need to use the Perspectives/Show View/Other… menu and toggle on the “Help” perspective. This docks the Help window into the Eclipse workspace along with the modeling and editing tools. Perhaps this option should be the default when viewing Help, rather than having the Help perspective replace the entire development workspace. It seems strange that there is no Print Preview option for previewing how diagrams will print. The File menu has the option, but it seems to be perpetually grayed. The toolbar has no such button at all. I have been unable to locate a built-in Jar utility for creating simple Jar files. There is a Jar utility associated with deploying an EJB component, but if you are not building an EJB you’d sure like to have a simple Jar utility. Besides, I am currently deploying the EJB portion of the Trievelet framework to the JBoss server, which is currently not supported by XDE. I don’t understand it when a Java IDE leaves out such a Jar utility when it would be very easy to describe which class packages belong in a given Jar file. So I have had to resort to building Jar files via external scripts. To me it is like a C++ IDE leaving linker integration out of the build process, and making you invoke it via command line instead; a completely unacceptable oversight. This is my biggest single complaint about XDE, and could well be directed toward the Eclipse team instead of Rational. I should also warn you about using the Autosync mode when viewing a diagram that has a huge class displayed. By “huge class” I mean a class with many attributes and/or methods – for example the Thinlet class in the project I have been working on. It takes a long time to synchronize the view, most likely because of all the parsing going on. I suggest that the Thinlet class is for good reason an unusually complex one. You will probably not experience this problem with your code. If you do, however, just toggle off the Autosync feature when viewing the class diagram that contains a huge class. Perhaps Rational will in the future provide a remedy for such situations, such as toggling off Autosync for a single class. None of these issues that I found were showstoppers. Also, as previously noted, the UML diagramming and software construction aspects of the Rational XDE are very solid, being based on a solid legacy foundation. Being that this is an early product, it is not surprising that there are some issues, and perhaps you or others have found a few of their own. Availability ============== Users of Rational Rose Enterprise who have a current maintenance contract can obtain a no-cost copy of Rational XDE. For the rest of us it won’t be that simple. Rational XDE Professional for Java Edition costs $3595 (and double that if you need the .NET Professional Edition along with it). The Rational XDE Professional Modeler Edition costs $2314. The $3595 price tag is more than Rational Rose Professional JEdition, but less than Rational Rose Enterprise. The Rational XDE Professional Modeler Edition is not only less costly, but may be all you need if you are not generating source code from models. Frankly, your only barrier to using Rational XDE may be its price. Some readers may not even have to think about price, but for me it’s not that easy. These days my executive management is watching cost like a hawk. I fully agree with being frugal in times of plenty and in times of conservation, but either way the cost of Rational XDE doesn’t make my job of promoting productivity and quality accelerators any easier. When I suggest ordering even 10 copies of the product on the first round, I’ m going to have to back that with proof of team optimization and clear potential for increased account profitability. I am simply not there yet. I’ d like to follow up with my cost-basis results in a month or two. Your feedback may give me a sense for the value that you’d place on such data. Any proof of ROI with XDE that you have discovered would be useful to me, especially if it includes justification around creating and applying your own code templates and patterns (reusable assets). Conclusion ============ The integrated modeling and source code authoring tools in Rational XDE have made me noticeably aware of productivity gains. I have found code synchronization useful. I am especially impressed with the code template and pattern development accelerators, and what they mean for future productivity. I would first wish for an integrated Jar tool, and then for JBoss/Server support, or an easy way to integrate with any unsupported J2EE server. While there are a few rough edges I have concluded that these are not damaging to overall user productivity. I suggest that Rational XDE Professional for Java Edition could be better priced in order to achieve widespread adoption. Suggestions aside, I believe that XDE has the stuff to make a reasonable amount of MDA a reality today, and will continue to take its users up the “model is the code” ladder for years to come. The URL for Rational XDE is: http://www.rational.com/products/xde/index.jsp