Geertjan's Blog

  • February 22, 2006

UML and NetBeans IDE (Part 1)

Geertjan Wielenga
Product Manager
Last week, when I was teaching NetBeans to Java instructors in Munich and London, one of the most frequently asked questions was: "What about UML? Does NetBeans provide anything in this area?" My standard answer was: "Currently not, but later this year you shouldn't be surprised to find UML support integrated in NetBeans IDE." All along, I knew that UML support was already in the process of being added. In fact, since yesterday, anyone interested in UML has been able to make full use of UML modeling in NetBeans (go here for the download). There's even a very interesting documentation page available, with an exciting list of tutorials: Preview: NetBeans IDE 5.5 with NetBeans Enterprise Pack 5.5.

Bearing in mind the interest shown in UML modeling last week, I went to the above documentation page and picked out this tutorial: UML Modeling: Reverse Engineering Java Applications. When I first landed on that page, it all looked a bit dry. "No screenshots?" I thought. But then I saw the "Show Me" links. They're great—short little demos of the step-by-step instructions found in each section.

So, anyway, I took the Anagram Game from the NetBeans samples and played around a bit, using the new UML modeling features. Pictures speak better than words, so here are a few pictures...

The first picture shows that in the New Project wizard there's now a new category called "UML" (also, if you look at the screenshot, there are other new categories called "Service Oriented Architecture" and "XML", but let's leave those for another day):

In the New Project wizard, I selected "Java-Platform Model by Reverse-Engineering a Java Project".

In the next picture, you see that I've selected the Anagram Game (you must have the application open in the IDE in order to be able to select it, which I think is a bit odd):

Next, the IDE does all the work in the background. You get prompted to approve one or two things, but that's all.

Here you see the colorful result in the Projects window of reverse-engineering an existing project:

The Projects window was never this exciting! You can expand the nodes and inspect what's going on within them:

Next, select all the nodes that you want to diagramize. Here, I was confused initially, because I selected a node and then assumed that all subnodes would automatically be included. This is not the case. You need to explicitly include each subnode that you want to work with in the next steps:

When you select "Create Diagram from Selected Elements", you get a dialog box that lets you choose the type of diagram you want:

Then a diagram is created (in my case, I chose "Class Diagram"), which you can zoom into, as shown below:

You can also create a dependency diagram...

...and, among many other features, you can select to reverse engineer a selected operation in the class diagram (which then produces another diagram, such as a sequence diagram, that shows the control flow, the sequence of behavior, and the concurrent processes and activations):

Soon, I'd like to play with the UML modeling features from the other side—i.e., start without an application and see how far the UML features go in producing an application from a UML model...

For me, though, there's one big problem: There is now so much to get familiar with in NetBeans IDE, it is becoming a serious problem for me! I still haven't done anything with mobility and the Profiler—but now, with all this new functionality (the SOA stuff looks very cool too, for example), I'm going to have to copy and paste myself at least 20 times if I'm going to be able to keep up with everything that NetBeans IDE is able to provide...

Join the discussion

Comments ( 4 )
  • Roman Strobl Wednesday, February 22, 2006
    I have the same problem... there's so many new features appearing right now and I can't keep track of them. And it will get only worse :)
  • James Wednesday, February 22, 2006
    Do you know if they will be adding support for exporting to xmi? I really like the tool from using it in studio, but not having the ability to export to xmi limits what I can use it for.
  • Tom Wheeler Wednesday, February 22, 2006
    Hi Geertjan,
    I'd like to try out the 5.5 beta but I am developing an application based on the 5.0 IDE now. Do you know if 5.0 and 5.5 can peacefully coexist on the same machine?
  • Geertjan Wednesday, February 22, 2006
    Tom, I have 4.1, 5.0 (one WITH the Sun Java System Application Server and one without), a post 5.0 dev build AND the 5.5 preview all on the same laptop... so far the heavens haven't fallen on my head. A user directory is created per version, so the 5.5 gets its own folder too. Therefore, as far as I can tell, they're all co-existing without a problem.

    James, I don't know enough about the UML support to provide an answer to your question. I'm assuming that everything Studio has is now in NetBeans, so if something wasn't in Studio, it isn't in NetBeans either...

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.