简体   繁体   中英

Is there a way to generate Java code from UML Activity diagrams in Netbeans?

I have seen previous questions on how to generate UML diagrams from code. Is there a way to do it in reverse, like having an existing activity diagram to convert into Java code?

This would be possible. ADs have quite a limited number of language constructs. Decision would translate to a simple if construct. CallBehavior would just be invocation of a class operation. And Fork / Join would need some support to be mapped to invocation of system threading operations.

But that's not all of it. I don't know of any system that's described in full with ADs. There are usually only a few ADs and many (/most) use cases are just described in text.

There's executable UML which might be something you can look into. I haven't seen it in reality in any project. To me UML is for (abstract) modeling. You don't bother too much with implementation. Then you pass on to the coder/hacker troop. They live in a somewhat different world. And you won't make them happy when doing all the programming already in UML. And for sure you won't get them into programming in UML.

It is impossible to generate working code from UML. You can only generate objects with empty methods.

Enterprise Architect can do that, for example. It can also reverse engineer existing classes. But both features are (in my opinion) much less useful as it sounds. At the end, you make the work of the programmer more complicated as before. These diagram can even not replace manually created documentation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM