The best or fastest way to understand a myriad and complex project

I have a complicated project with no comments. The project is programmed in Java, but has more than one main class, uses several .txt files, such as a template, and uses several .bat files. I do not know where to start and how to start searching for a project, because I need to make some changes to this project.

+7
projects-and-solutions project-management solution project
source share
11 answers

Like others, I say this is a slow process.

However, having done this many times in the past, this is my methodology:

  • Define as many requirements that the code fulfills. This may give you some reasons why some things are what they are when you look deeper. A common way to find them is to search for any available tests. Automatic is best, but usually they are as absent as comments.

  • Find code entry points. This will give you places where you can push the code to see how different inputs affect the stream. Common entry points are the "Basic" code input functions, service interfaces, backlinks to web pages, etc.

  • Draw the code. Check out the tools that can create black and white snapshots of code. For me it is priceless. Sometimes I printed large lists and then attacked with bullets and rulers. You are aimed at creating your own flowchart (mental or otherwise) of the code stream.

  • Using the above (iteratively) create a set of outputs for the code that you think should happen, and add outputs to them that you may already know about, such as logs, data files, records in the database, etc. .

  • Finally, if you have time, create some manual tests, although preferably in automatic test harnesses, to test this. This is when I start attracting a debugger to see the details in the code.

This technique usually gives me confidence in making changes.

Please note that this is an iterative process and may be performed with parts of the code or as a whole at your discretion. I usually prefer a top-down approach, and then when I get some information, I turn around until the details become overwhelming, and then repeat. However, this is only because my mind works in this way - you can be different. Good luck.

+6
source share

Find the main main class. A starting point. Start drawing images of the classes and objects that they own and the external objects that they reference. Follow all the branches until you find a logical conclusion.

I have used UML reverse engineering tools in the past, and although the visual picture is good, code navigation has always been the most complex and at the same time the best methodology for me.

And after going through each part, you can add your own comments.

+3
source share

I usually start with doxygen, turn on each extraction option (especially EXTRACT_ALL and EXTRACT_PRIVATE) and turn on the options SOURCE_BROWSER, HAVE_DOT, CALL_GRAPH and CALLER_GRAPH (you also need to set a point). This gives a good idea of ​​the software. For each function, calls are displayed and linked on a graph, and sources are also linked.

While doxygen is designed for C and C ++, it also works with Java sources (set the OPTIMIZE_OUTPUT_JAVA option).

+3
source share

I would try to find the first entry point in the nearest code where you suspect that you will need to start making changes, set a breakpoint and start debugging . Check the contents of local variables and go deeper when you know what is going on. Then, when you have a basic understanding of the area of ​​code that you are going to work with, start playing with a few changes . Test your understanding of this. Try to chart what you see. . If you can do it confidently, you can decide whether you need to go back and continue to study the code, or if you know enough to do what you need to do.

+2
source share

Auch. I'm afraid there is no quick way to do this. Comment out a line (or two) -> test -> see what breaks. You can also put break statements here and there and run the debugger. This should give you some idea of ​​how you got there (for example, what is the hierarchy between classes).

We hope that the original developers used some templates that you can recognize and take notes. Take a lot of notes in total. Start by trying to understand the high-level structure and work from there.

Be prepared to spend endless hours without realizing what it does.

Talk with the client and try to understand what the project is for and what it is all that it does. Someone somewhere had to establish some requirements for what's there, if only in an email.

+2
source share

Start - use the automated uml modeling tool (if you use eclipse, you can use the plugin) and start creating UML diagrams of various classes to see how they are connected at a high level and visualize the code.This has helped many times

0
source share

If log files are being created, look at this to understand the flow from the starting point (main class). Otherwise, put debug statements to understand the flow.

0
source share

Ya, that sounds like a pretty bad point you're at.

I would say that the best way is to simply go through the program line for the line. Try to understand the big picture in the code and write a lot of notes, both on paper and in the comments in the code.

0
source share

I would say that a good approach would be to create documentation using the chart function of the javadoc or doxygen class, and then when you run the code through class diagrams generated with doxygen and see who names what. This works great for me every time I work on such a project.

0
source share

I completely agree with most of the answers.

I can add to use a development tool that reverses code development and creates a class diagram in order to have an overall picture of what is involved.

Then you need patience. But you will become a stronger and smarter developer when you pass ...

Good luck

0
source share

One of the best and first things is to try to create and run the code. This may seem a little simplified, but the problem with getting undocumented code is that you can't even create and run it. When there was no clue to start.

0
source share

All Articles