I'm using IBM Rational Rose, but I'm not sure if I'm able to model/design the methods/procedures which are known as "operations" within a class onto "UML User Class Diagram". Is there any way to model the algorithm or the code of 'operations' (i.e something like flowchart) via the software? If so, is there any possibility to get the methods design auto-implementation integrated via code generation in order to define them within a java source file?
2 Answers
Another way to model behavior is to use StateMachine, Constraints, Sequence and Timing diagrams. Of course, you can simply write Notes describing behavior in plain words.

- 35,448
- 8
- 62
- 86
-
And if you really want to generate code, it should be better to use state machine diagrams : theirs formalism is more mastered by UML software than the one of activity diagram and UML softwares often provide more tools around state machines diagram than on activity diagram. – granier Oct 28 '17 at 09:08
-
@granier Yes, a StateMachine can rather easily be transformed into code. Especially in embedded systems they are used in great variety. However, in business processes the ActivityDiagrams like in your answer are more common. – qwerty_so Oct 28 '17 at 11:17
-
@ThomasKilian What are the tools that can do so? – user6039980 Oct 28 '17 at 11:20
-
@ThomasKilian As you mentioned above that a "StateMachine can rather easily be transformed into code", I would like to know what tools can automate this task? – user6039980 Oct 28 '17 at 12:27
-
1Enterprise Architect has that (from some license on). More than 15 years I last touched RR but that time I used it's API for lots of things. From a guess it wouldn't take me a whole day to create a basic exporter. One week with quite some bells and whistles. – qwerty_so Oct 28 '17 at 14:03
-
1There was a variant or Rose, Rose Real Time, that did complete model code generation. It has since been replaced by IBM Rational Software Architect for Real Time (which is hidden on IBM's web site). Also, Rose had add-ons that allowed for the generation of structural code (but not the additional operations content). – CharlesRivet Oct 30 '17 at 21:39
You can use activity diagram, activity diagrams are near a flow chart.
On your activity diagram, you create a partition and you can link your partition to you operation. Then you create callOperation action which can be linked to method call.
I create a class diagram with 4 class Class1, Class2, Class3, Class4, each one containing a method operationx.
And here is a simple example modeling operation1. The important point is that the partition named Operation1 is linked in the UML model to Class1:operation1 and the 3 actions are linked to method operations. This is not a "typo" tips.
You can look also to sequences diargam but it does not look like a flow chart.

- 1,739
- 13
- 25
-
Hi, I know that but how can I include the method design with the code generation? – user6039980 Oct 28 '17 at 08:48
-
For me (my opinion) Generate code from structure diagram, id class diagram is easy, From behavior diagram, this is another story. And if you try, you will have complex diagram and it will be more efficient to write the code by hand. @Kilian explains this about SQ as answer to another question, and that's make sens. – granier Oct 28 '17 at 09:04
-
Ok. But what's the purpose of the `code generation` tool then? is it designed only for generating the attributes within a class? If so, then what makes UML different from a DB schema? – user6039980 Oct 28 '17 at 09:13
-
But DB schema models data only, UML models specifications (Use case), sofrtware architecture (package and components), code with classes and how classes interact whith each other, and deployement and so on. UML is not only a language to model data ... But generating a code from schema is a complex task except for state machine when a "switch" can fill the need. – granier Oct 28 '17 at 10:48
-
Right. If I understand correctly, I have to go with the tool 'Enterprise Architect'? – user6039980 Oct 28 '17 at 10:56
-
1I am not sure what you mean, but for me, you should forget to generate all code from behevior diagrams and look to the tool document. Google show a lot's of ibm pdf about code generation from IBM Rational architect. If you need more, you can extract your model in a XMI file and use another tool but here it is not allowed to advise about tool – granier Oct 28 '17 at 12:22
-
It should be noted that IBM Rational Rose also has the ability to create activity diagrams, although they look (slightly) different from RSA. And rose also had (has) code generation add-ins. – CharlesRivet Oct 30 '17 at 21:37