In last post I talked about creating sequence diagrams using MaintainJ. Another important aspect you would want to understand for a Project is the database schema design. How many tables are there? How do they interact with each other? etc.
For understanding this design the best way is to look into ER or Entity Relationship diagram. Ideally one would create the ER diagram first and then implement database.
In case we do not have a ER diagram available we can create using Reverse Engineering the database to ER diagram.
For MySQL, we can use MySQL WorkBench tool to create one.
Download the installer from https://www.mysql.com/products/workbench/
Once installed, you can connect to you mysql database in workbench. Then in Database Tab at the top, select Reverse Engineer option, and select the schema you want to reverse engineer.
The best way to analyze the code with hundred of Java classes is to look into the documentation, class diagrams, sequence diagrams etc to understand the flow and usage. Unfortunately there are times when you would not be provided with any such documentation.
Reverse Engineering tools can be of help upto some level. MaintainJ is one such tool to help you with Java.
So if you have a working codebase for a web application, which you need to analyze, here are the steps to go ahead.
1. Download the MaintainJ war file from http://maintainj.com/userGuide.jsp?param=install
2. Add the war file to the server where main application (to be analyzed is available), for example if you project war file is added to tomcat – tomcat/webapps, add the MaintainJ.war
3. Now if you will visit the link to server like http://localhost:8080/MaintainJ/, it will let you provide the package to be traced and directory where output file to be added.
4. It will provide simple settings to be added to catalina.sh (or other server config),
5. Once all settings done, restart the server.
6. Go to MaintainJ link and start tracing.
7. Now browse through the actual app, MaintainJ will create sequence diagrams to the directory where you have provided the path.
You can view the ser file created by MaintainJ in eclipse by adding MaintainJ plugin to eclipse. Create a new project of MaintainJ trace type and copy generated ser files into this project in a folder.
A good overall demo is provided – http://maintainj.com/userGuide.jsp?param=overviewDemo