Categories
Computing Java

Critique of ArgoUML

I am using two free Java-based UML tools for my software design and patterns class.

One is Violet, which is brilliant in the fact that it limits its own scope and functionality so much that it is extremely useful and very easy to pick up, while being limited.

The other is ArgoUML (I am using version 0.18.1) which is at the opposite end of the scope scale. It has a lot to offer but when you offer a ton, you sometimes compromise on the basics. ArgoUML used to offer all of the major UML diagrams, but apparently the implementation was buggy enough for them to disable sequence diagrams, among others. Their class diagram support, though is strong and the application is very servicable. Until certain little things come up.

Suppose you want to output an image of a small section of your very large model. The logical things that come to mind are:

  • selecting the classes you want to output and selecting the ‘output to image’ function
  • selecting the relevant classes, copying them to a new model with the relationships between them and then outputting the model to an image

Sadly in ArgoUML the first option will always output the entire model no matter what, and the second option will only copy the actual classes, but not the relationships (the lines) between them.

Next time you think how much Visio sucks, appreciate the little things.
The problem with Visio, is that its UML support is not great; the model looks sort of like correct UML, and it is very Microsoft-technology centric, as opposed to the Java-centric approach of ArgoUML (Violet is so basic it is agnostic – hence less is more!). And yeah, Visio costs an arm and a leg. And if you are paying, you can just as well get SmartDraw and be done with it.

I will stick with my limited but lovable tools for now.

More comments about ArgoUML:
– No undo/redo functionality
– Impossible to copy and paste method definitions

Share
Categories
Java

Java 1.5 bug – Transfromer needs some coaxing

My current class assignment requires me to produce XML. Not so wisely I am using DOM to build the Document, but then the benefit comes in the form of Java’s Transformer object. What a fine object it is – the one and only meant to commit your XML to a file.
Still, what used to work in Java 1.4 somehow broke in Java 1.5; Transformer no longer obeys the following instructions that are meant to set it to indent its XML output:

TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer();
transformer.setOutputProperty(OutputKeys.METHOD, "xml");
transformer.setOutputProperty(OutputKeys.INDENT,"yes");

Naturally, I Googled this issue and as usual, the best place to find an answer were the Sun Java Forums. Many people offered help but the one that actually cracked this problem was one xuemingshen in this thread: His solution — use an OutputStreamWriter object as the parameter for the StreamResult that will be used by the Transfomer when it performs the transformation. The code:


try
{
Source source = new DOMSource(myDOMDocument);
File outputFile = new File(fileName + ".xml");
FileOutputStream outputStream = new FileOutputStream(outputFile);
Result result = new StreamResult(new OutputStreamWriter(outputStream));

TransformerFactory factory = TransformerFactory.newInstance();
factory.setAttribute("indent-number", 4);

Transformer transformer = factory.newTransformer();

transformer.setOutputProperty(OutputKeys.METHOD, "xml");
transformer.setOutputProperty(OutputKeys.INDENT,"yes");

transformer.transform(source, result);
}

catch… TransformerConfigurationException, TransformerException, FileNotFoundException

I am using a FileOutputStream object to output to file but an OutputStream object will do.
Thank you xuemingshen !

Share
Categories
Java

Setting Transformer properties

So you are going to output an XML Document to a file using this canonical method. But how do you tell the Transformer object how the output should look like?

You use OutputKeys, that’s how.

For example:
transformer.setOutputProperty(OutputKeys.INDENT,"yes");

Share
Share