Design and Architecture of Complex Software Systems (DACSS)

Assignment 2: The Reflection Pattern - Track A: Using reflective features of programming languages

MyReverseEngineeringTool

This is one of the choices for Assignment 2.

Objectives: Using reflective properties of programming languages - using Introspection

Assignment description

Using reflective capabilities of java (java.lang.reflection) or .NET (System.Reflection) implement a simple reverse engineering tool to extract design information from compiled code.

Requirements

Standard requirements: The tool accepts as command line arguments the name of a compiled file (could be a *.jar file or a *.dll / *.exe file) and extracts all informations that are needed to describe the class diagram of the classes contained in this file. It is not necessary to graphicallly draw the class diagram, but to display (textually) all the informations of this type: classes, interfaces, methods, fields, relationships between classes/interfaces.

For Java implementation: Use the utility class java.util.jar.JarFile to open a jar file. Use a URLClassLoader to load classes and retrieve the Class metaobjects. Use intensivly introspection to gather information.

Optional requirements: Bonus 1 point: The output extracted by your tool must be in a format accepted by a UML drawing tool, such as yuml. Implement a good design for your tool, such that new output formats for different UML drawing tools can be added with minimal effort. Your tool also must be able to receive additional configuration options:

You can distinguish 4 types of relationships between classes and/or interfaces: extends, implements, association, dependency. Please note that information extracted by reflection is not enough to distinguish subtypes of associations such as aggregation or composition. Thus aggregation and composition relationships will be reverse engineeered as associations by your tool.

Cardinality of association relationships is ignored.

When parametrized types are found, include also its actual type arguments in the diagram.

Example: for the code given in TempSensor.jar, your tool produces the output TemperatureSensor.txt. If you put the description in yuml it will draw the reverse engineered classdiagram of TempSensor

Example2: For the code given in EventNotifier.jar your tool produces the output EventNotifier1.txt if the tool is used with the option to put class members on the diagram, respectively EventNotifier2.txt if it is used without this option. The class diagrams drawn by yuml are classdiagram case 1 respectively classdiagram case 2.

Bibliography