[go: up one dir, main page]

0% found this document useful (0 votes)
20 views4 pages

Software Engineering Exp10

The document outlines the process of reverse engineering in Java, which involves converting existing code into UML class diagrams to aid in understanding legacy systems and improving documentation. It details the steps involved, provides sample Java code for an Employee and Manager class, and suggests tools for automatic UML generation. The conclusion emphasizes the benefits of reverse engineering for developers in visualizing code structure and facilitating system maintenance.

Uploaded by

lput4439
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views4 pages

Software Engineering Exp10

The document outlines the process of reverse engineering in Java, which involves converting existing code into UML class diagrams to aid in understanding legacy systems and improving documentation. It details the steps involved, provides sample Java code for an Employee and Manager class, and suggests tools for automatic UML generation. The conclusion emphasizes the benefits of reverse engineering for developers in visualizing code structure and facilitating system maintenance.

Uploaded by

lput4439
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Experiment 10

Experiment: Perform Reverse Engineering in Java (Code


to Model Conversion)
Objective
To understand and demonstrate reverse engineering — the
process of converting existing Java code into its
corresponding UML class diagram or model. This technique
helps in understanding legacy code, documentation, and
system maintenance.
Theory
Reverse Engineering in software engineering is the process
of analyzing software to extract design and architectural
information. Unlike forward engineering (model → code),
reverse engineering does the opposite: code → model.
This is particularly useful when:
 Source code exists but documentation is missing
 One needs to refactor or improve system design
 Understanding complex legacy systems
Steps Involved:
1. Analyze the existing source code.
2. Identify classes, attributes, methods, and relationships.
3. Create UML models (typically class diagrams) based on
code structure.
Java Code for Reverse Engineering
public class Employee {
private String name;
private int id;

public Employee(String name, int id) {


this.name = name;
this.id = id;
}

public void displayDetails() {


System.out.println("Name: " + name);
System.out.println("ID: " + id);
}
}

public class Manager extends Employee {


private String department;

public Manager(String name, int id, String department) {


super(name, id);
this.department = department;
}

public void displayDetails() {


super.displayDetails();
System.out.println("Department: " + department);
}
}

UML Class Diagram Representation


We will reverse engineer the above code into the following UML
structure:
Classes:
 Employee
o - name: String
o - id: int
o + Employee(String, int)
o + displayDetails(): void
 Manager (inherits from Employee)
o - department: String
o + Manager(String, int, String)
o + displayDetails(): void

Tools to Perform Reverse Engineering Automatically


1. IntelliJ IDEA / Eclipse + UML Plugin
o Many IDEs can generate UML from Java code using
plugins.
o Example: ObjectAid (Eclipse), SimpleUML (IntelliJ)
2. StarUML / Visual Paradigm
o Import source code and auto-generate diagrams.
3. Online Tools
o draw.io (manual creation)

Conclusion
Reverse engineering helps developers visualize the structure of
existing codebases. This aids in documentation, debugging,
refactoring, and onboarding new developers to the project.

You might also like