Posted: January 01, 2011 20:49 by javydreamercsw
Is it possible to completely describe a UML class diagram using nothing but valid Java code? Is it possible to find make approximations that might be useful?
Java is a subset of UML; whilst a set of Java Classes can be represented in UML not all UML Class Diagrams have a direct Java equivalent. Java does not support multiple inheritance for example. There are other more subtle problems that prevent Java code from completely describing a class hierarchy, such as the words that appear above Association lines - these may well be used in comments found nearby to a variable declaration, but there is no automatic way to glean which word(s) should be used by reading the file.
In order to keep UML diagrams synchronous with Java code it is prudent that there be only one canonical source for all UML information, and it would be great if this could be the Java code itself. This page is about how this might be achieved?
Currently we have three alternatives, or some combination of them.