Java Class and UML Modeling with JDeveloper

Do you design before you code? It used to be a best practice to do that, but now with agile development on the rise it seems less people actually do conceptual design as they rather just code as fast as possible.

One nice feature of JDeveloper is that it can make it seem like you actually did conceptual design even if you didn't do it.We can take code that you wrote and make a diagram out of it so you can pretend you modeled things - or in case you need to explain what you did to your managers.

JDeveloper is one of the more powerful free tools out there that offers UML modeling for your code. We do both conceptual modeling - which is not tied to a specific language implementation, and physical modeling of Java code. In the demo below I'm showing how easy it is to start for a set of Java classes that you coded, and transform them into a Java class diagram, then take the physical model and transform it into conceptual UML class diagram, and then take that conceptual model and transform it to another type of physical model - a database model.

Comments:

Very handy Shay, but i have a related question for you. What about creating sequence diagrama with this uml classes? I tried to create a sequence diagram with the uml classes but is very annoying since you can´t drag the new uml classes. Instead, you have to create a new object lifeline, then go to the properties put the name and select the class....I am missing something or this is the only way to go?

thanks!

Posted by juan on August 30, 2011 at 08:22 PM PDT #

Juan - I'm not exactly sure what you mean when you say "creating sequence diagrama with this uml classes" - these two diagrams are separate in JDeveloper. You can just choose to create a new sequence diagram from the menu - you can then drag java classes onto that diagram.

Posted by Shay on September 01, 2011 at 04:42 AM PDT #

Shay, you are correct that you can drag & drop the classes to the sequence diagram, but they don´t convert to object life line so they are useless in a sequence diagram. Instead, you have to add a object lifeline to the diagram, then go to prperties and select the class....this is not useful at all and I guess by your comment that there is no other way of doing this. For me, the way to go is that you drag and drop a class to the diagrama and it gets converted to object lifeline automatically.

thanks anyway for answering
Cheers

Posted by juan on September 01, 2011 at 08:37 PM PDT #

Hi,

Thanks for the Demo. Can I create the diagram for a complete project? Say I have a Model project which consists of about 70 Java classes, split into different packages.

Can I create a class / Collaboration diagram for these classes in a single drag-drop?

Posted by guest on October 12, 2011 at 08:33 PM PDT #

guest, you can shift+select all the classes in your application navigator and drag them all at once to a new diagram.
There is currently no way to automatically create a diagram for a project without specifically selecting the classes.

Posted by shay on October 13, 2011 at 03:14 AM PDT #

Hi Shay,
thanks for short but really useful introduction into modeling with JDeveloper!

I have a problem transforming physical class diagram to conceptual with the following exception:
java.lang.IllegalArgumentException: Expected: L3::Interface
at oracle.mof.generic.InstanceHandler.checkValid(InstanceHandler.java:73)
at oracle.mof.generic.SingleValueAccessor.set(SingleValueAccessor.java:67)
at oracle.mof.generic.GenericClass.set(GenericClass.java:603)
at oracle.mof.generic.GenericObject.set(GenericObject.java:253)
at oracle.mof.model.TransactionObject.set(TransactionObject.java:144)
at oracle.uml.v2.umljava.transformation.UMLTransformationModel$UMLTransformationElement.setValue(UMLTransformationModel.java:1427)
at oracle.uml.v2.umljava.transformation.UMLJavaTransform.copyProperties(UMLJavaTransform.java:619)
at oracle.uml.v2.umljava.transformation.UMLJavaTransform.transformRealization(UMLJavaTransform.java:311)
at oracle.uml.v2.umljava.transformation.UMLJavaTransform.transform(UMLJavaTransform.java:277)
at oracle.uml.v2.umljava.transformation.UMLJavaTransform.transformChildren(UMLJavaTransform.java:596)
at oracle.uml.v2.umljava.transformation.UMLJavaTransform.transformClass(UMLJavaTransform.java:344)
at oracle.uml.v2.umljava.transformation.UMLJavaTransform.transform(UMLJavaTransform.java:237)
at oracle.uml.v2.umljava.transformation.UMLJavaTransform.transformChildren(UMLJavaTransform.java:596)
at oracle.uml.v2.umljava.transformation.UMLJavaTransform.transformNamespace(UMLJavaTransform.java:414)
at oracle.uml.v2.umljava.transformation.UMLJavaTransform.transform(UMLJavaTransform.java:286)
at oracle.uml.v2.umljava.transformation.UMLJavaTransform.transformChildren(UMLJavaTransform.java:596)
at oracle.uml.v2.umljava.transformation.UMLJavaTransform.transformNamespace(UMLJavaTransform.java:414)
at oracle.uml.v2.umljava.transformation.UMLJavaTransform.transform(UMLJavaTransform.java:286)
at oracle.uml.v2.umljava.transformation.UMLJavaTransform.transformChildren(UMLJavaTransform.java:596)
at oracle.uml.v2.umljava.transformation.UMLJavaTransform.transformNamespace(UMLJavaTransform.java:414)
at oracle.uml.v2.umljava.transformation.UMLJavaTransform.transform(UMLJavaTransform.java:286)
at oracle.uml.v2.umljava.transformation.UMLJavaTransform.transform(UMLJavaTransform.java:158)
at oracle.uml.v2.umljava.addin.UMLJavaTransformAddin$2.transform(UMLJavaTransformAddin.java:189)
at oracle.bm.transform.TransformationManager$Transformation$1.construct(TransformationManager.java:329)
at oracle.ide.util.SwingWorker$2.run(SwingWorker.java:132)
at java.lang.Thread.run(Thread.java:619)

Do you know what can cause this??? - any ideas would be really appreciated...

Thanks and Best Regards,
Yury

Posted by guest on May 28, 2012 at 08:29 AM PDT #

THANK YOU VERY VERY VERY MUCH!!!

Posted by guest on May 31, 2013 at 07:29 AM PDT #

This is just what I was looking for.
Great post Shay. Thanks.

Posted by Ganesh on August 03, 2013 at 08:15 PM PDT #

wow nice

Posted by guest on November 25, 2013 at 07:03 PM PST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

me
I'm a Director of Product Management for the Oracle Java Development Tools.
Follow me:
Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today