The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

code to uml and back

How come IDE's don't come with the ability to transform your code into UML diagrams or some other suitable diagrammatic notation on the fly.  Wouldn't this be helpful to developers to see the architecture, layout of their code/design?

What are your opinions?
Andy
Tuesday, November 30, 2004
 
 
EiffelStudio shows how this should be done.

It uses BON rather than UML, but it is very clever.

The BON diagrams and Eifel code are synchronised.  Changes in the diagram is reflected in the code and vice-versa.

Unfortunately its only available in the full price edition, though you can download the trial version to see it in action.

http://www.eiffel.com/products/studio/screenshots/powerful_bon_diagramming_tool.png
Ged Byrne Send private email
Tuesday, November 30, 2004
 
 
Because the 'code to diagram and back' transform has never been completely defined.  You can only code something to happen (in an IDE, for instance) after it has been completely defined.

There are 'after-compiler' products which will do *some* of this for you.  UML-Studio does a nice job of transforming a Class diagram (created in UML-Studio) into the appropriate .H and .CPP files.

It does *not* do this for sequence diagrams, or Data Flow Diagram diagrams.

Understand for C++ will ingest a C++ project, and generate diagrams on the fly.

There *is* a move currently to update UML so that it will serve the role of generating code from diagram.  So far, we in the industry are not there yet.
AllanL5
Tuesday, November 30, 2004
 
 
There was a modeller in Visual Studio 6 (enterprise version) which was a limited version of Rational Rose. It *could* do some limited uml <-> code conversion (buzzword = "round trip engineering"). Other than salesdroids, I never met anyone happy with the code it produced, or the pictures it produced. And that limited version of RR left out the diagrams I feel are the most important: state charts and swimlanes. I was not about to drop $5k for the version that did have those drawings.
Peter
Tuesday, November 30, 2004
 
 
"Swimlanes"--an interesting name for a sequence diagram. I'll have to remember that one.
oopfoo
Tuesday, November 30, 2004
 
 
Thanks everyone for you input.  I'm actually thinking of developing such a product.  Mainly for the C# language, because that is what I use most of the time.  Do you think it's a tool that a lot of developers would want?  I do see a lot of developers including my self doodling diagrams of their  source code in their own notation, trying to work out what is happening in a mesh of object interaction.

What kind of diagrams do you think are most usefull for developers?  A couple of you have mentioned state, message trace diagrams.  Or do you think intelli code sense thing that's in visual studio good enough and makes a graphical representation during dev. redundant?
Andy
Tuesday, November 30, 2004
 
 
Andy, are you aware of Enterprise Architect? It does a fairly solid source code (C#, Java, ...) to UML translation, and vice versa (though I haven't tested the other direction). And it's only $225 for the most expensive edition.

EA is made by Sparx: http://www.sparxsystems.com.au/
Chris Nahr Send private email
Tuesday, November 30, 2004
 
 
I believe it is a misuse of UML.

IMO UML - or any such diagrammatic view of a software application - is a guide that may omit classes, group classes together, or present the details in a summarised form.

My most recent project had hundreds of classes, and a complete UML diagram of this would have been unusable and a waste of my time and therefore project funds. I simply sketched out the general approach, added a few notes, and handed it to the very capable developers on the team. The more complex areas where there was a lot of potential for misunderstanding were diagrammed completely.
Herr Herr Send private email
Wednesday, December 01, 2004
 
 
Why would anyone want to do that? Diagrams are fine for design ideas, and documentation. But the whole 'modeling as a replacement for coding' movement leaves me cold. There's a reason why software has never been successfully converted into an engineering discipline - it doesn't belong there.

It's CASE all over again. Ugh.
.NET Guy
Wednesday, December 01, 2004
 
 
The main problem in coverting code to UML and back is that there is no one to one mapping. Herr Herr and others mentioned this already.

Let me give an example to illustrate this: Given two class A and B and a 1..* association between them:

A 1 -> * B

This is the conceptional design.

However, in code, you will us either a system collection class (ArrayList or HasTable) or a handmade typesafe class derived from the system classes to express this association:

A 1 -> 1 MyTypeSafeCollectionOfBsClass

This is one *possible* but not the only implementation, in .NET 2.0 you may decide to use generics instead.

If you transform this back into UML, what you should do? Create a 1..1 association between A and MyTypeSafeCollectionOfBsClass? This would be wrong. The converter must recognize MyTypeSafeCollectionOfBsClass as actually expressing a 1..* relation ship and preserve the information about what kind of collection actually was used (there is no place for this in UML, however).

And this is just a simple case. Think of associations with multiplicities of 2..5, where checking is done in the addB and removeB functions. ;-)
Gerd Riesselmann
Wednesday, December 01, 2004
 
 
I'd guess by creating a UML diagram just from the code, it would map  ArrayListOfClassB to just an ArrayList.
Andy
Wednesday, December 01, 2004
 
 
While Herr Herr et al. are correct, you guys apparently don't know how powerful these tools are.

When you reverse-engineer code with Enterprise Architect, i.e. read an existing C# project, EA will store *everything* about that project that it can handle.

However, creating a diagram from this internal data is a *separate* step, and completely customizable.

You can tell EA which classes to show, which members to show (individually, by access level, or by some arbitrary category), which connections to show, which labels to show...

It's easy to make multiple diagrams from the same internal code representation, each with a different level of detail. So it's not like the reverse-engineered diagram automatically includes every private field!
Chris Nahr Send private email
Wednesday, December 01, 2004
 
 
Chris, even Rational Rose can do this, so can every other CASE tool. A diagram always is a representation of some aspects, not always the whole thing.

The question is what you want. Do you simply want all your classes with all their methods and members together with information about how they link in your code? This is no problem. Or do you want to extract the design from the code, which means abstracting from it? I doubt EA can do it.

To the OP: There are tools out there that e.g. create diagrams of dependencies between classes or components. They trace the code and create lists about what function is invoked from where. Information like this can be useful from time to time.

I used something like this once in the VB days, but do not remember the name. I googled a while, but my search termns where not good enough, so no link, actually.
Gerd Riesselmann
Wednesday, December 01, 2004
 
 
"Chris, even Rational Rose can do this, so can every other CASE tool."

I didn't doubt that. I was merely using EA as an example because that's what I have experience with.

"A diagram always is a representation of some aspects, not always the whole thing."

As I understood the previous comments, some people were unsure about this fact; hence my post.

"Or do you want to extract the design from the code, which means abstracting from it? I doubt EA can do it."

??? Yes, you can, as I just outlined.

Of course you have to do this extraction manually, but this is aided by filters, such as "don't show any internals".

And in order to get working code you do have to specify all the implementation details, eventually. But I'm not using UML to generate code, merely to document code, so I can't comment on how difficult that path would be.
Chris Nahr Send private email
Thursday, December 02, 2004
 
 
+1 for what Chris is saying.

Another tool in this vein for C# and Java:
 http://www.logicexplorers.com/index.html
Mark Pearce Send private email
Thursday, December 02, 2004
 
 
I'm surprised that no one here has mentioned Rhapsody by I-Logix.  That tool not only models and produces code, but actually allows you to "execute" the model.  You can work almost exclusively within the tool. 

From their web-site:
Rhapsody is the industry's leading UML 2.0 based Model-Driven Development environment for systems and software engineering, and has the unique ability to extend UML 2.0 to allow both functional oriented and object oriented design techniques to co-exist in one environment.

Model-Driven Development (MDD) technology enables you to achieve unparalleled gains in productivity over traditional document driven approaches by enabling you to specify your systems and software design graphically, execute and validate the system as you build it, and ultimately produce full production code from the model for the target system.

Seamless Environment for Systems and Software Development
Requirements Modeling
Design-level Debugging on Target
Directly Deployable C, C++, and Ada Code Generation
Automatic Test Vector Generation


http://www.ilogix.com/rhapsody/rhapsody.cfm
Scott A. Mintz Send private email
Thursday, December 02, 2004
 
 
Personally, when I go to a tool web-site, and there is not the least indication of a price, I get very suspicious.  Especially if the tool is some high-end does-everything CASE tool -- like Rhapsody.

What I get suspicious about is what *is* the price?  I've used with Rational Rose ($5K per seat) and been unimpressed.  I've used System Architect ($6K per seat) and again been unimpressed.  I've used UMLStudio ($500 per seat) and it does a very good job.

Every 'high-end' tool I've tried to use so far has had serious draw-backs associated with it, and never met its promise of 'draw-it, generate code, run'.

So, what is the price of entry of Rhapsody?
AllanL5
Thursday, December 02, 2004
 
 
Borland also have a product that apparently does this well.  (Called "Together", it was one of the products they purchased a few years ago, IIRC).

However, I haven't used it myself.  I agree with Herr Herr that simpler approaches, focussing on summary rather than detail, are generally better.
John Rusk Send private email
Friday, December 03, 2004
 
 
Yes, Borland's Together technology is known as 'Eco' in the Architect version of Delphi.  I've only seen demonstrations, but it looks very cool.  These tools fall within category known as "Model Driven Architecture" ("MDA") tools.

ModelMaker is another very cool and inexpensive ($300) UML CASE tool for Delphi:  http://www.modelmakertools.com/mm.htm

Not sure how the other tools like Rational Rose work, but ModelMaker allows you to create your UML diagrams of classes, methods, relationships between classes, etc. either diagrammatically or by abstracting them from code.  It's a "two way" tool.  Once done you can go back and forth from Code View to UML Diagram View making changes in either view that will get reflected automatically in the other view.  It doesn't create any code that would actually run as an application, just creates a skeleton of the class structures declarations and method headers; you then add the appropriate code yourself. 

But it's a very useful tool.  ModelMaker is somewhat similar to Enterprise Architect that's already been mentioned in this thread.  But EA is targeted more at giving you a high level view of things and isn't really used much in your nitty-gritty day-to-day coding.  ModelMaker is targeted at a lower level where you interact with it directly while coding your classes and methods, helping create the skeleton of your application and doing some nifty refactoring stuff in ModelMaker, while you use the code editor back in Delphi IDE to flesh out the actual code in the skeleton that ModelMaker builds and maintains for you.
Herbert Sitz Send private email
Friday, December 03, 2004
 
 
I have used Rational Rose, Enterprise Architect and Together and all have their strengths and weaknesses. As a general rule I haven't seen the roundtrip work that well with C/C++ but Together does a pretty good job at java roundtripping.

Enterprise architect is a nice tool for the money and does compete pretty well on the CASE tool market. Also it has a plugin in beta for Eclipse which looks promising. Before version 4.1 of Enterprise architect there was an issue with roundtripping code. It use to suck in the code and just keep the structure without the actual implementation which would make the re-generation not work to well :) Sparks has fixed that issue in 4.1 though.

Also I found the concept of MDA is nice but the practicalness has some voids. The docunebtation aspects are quite nice though.
Daniel Marchant Send private email
Monday, December 13, 2004
 
 
By the way Enterprise Architect stores it's data in an Access database. This is nice for extracting parts of your model that can be used for other generation purposes.
Daniel Marchant Send private email
Monday, December 13, 2004
 
 
I own a copy of VisualUML.
http://www.visualuml.com
Mark Jerde
Monday, December 27, 2004
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz