How to understand a software project without knowing the language

This article will introduce how to understand a project. Take a java project as an example.

Part I The big picture

Firstly, go through packages(files) and find the play button icon. Generally, it is located in UI or Main package. Execute the program and see what functions it has. Good naming usually explains itself.

Screen Shot 2019-12-29 at 1.24.07 pm.png

Next, look at package relationship. Start examining import classes in the runnable class.

Screen Shot 2019-12-29 at 1.25.12 pm.png

Keep digging until it imports no self-defined class. Draw a diagram to record the findings.

Screen Shot 2019-12-29 at 1.22.09 pm.png

The final step is to check class relationships. Comment a whole class and see what will be affected. There’ll be some red errors if there’s dependency. Likewise, draw a diagram to note your findings!

Part 2 A closer look

Class holds related data and operations. Inside a class, we can see methods, each of which is the smallest unit that can perform a function. Only the class with main method can be executed. So let’s start from the main method first.

A method can also call other methods, just like a class can import other classes. We will chase down methods until Java’s original methods. We form this kind of information into a call graph.

methodA  ------ methodB ------ methodD

         ------ methodC

At a more granular level, how to know what does the method do? We can check it from three perspectives.

Require : What does it expect/assume? 

Modify : What will be changed? (Only mutable objects. Also, 
functional programming doesn't modify objects but only creates new.)

Effect : What does it produce

 

Leave a comment