How do you understand a large chunk of code?

前端 未结 5 807
梦谈多话
梦谈多话 2021-02-04 09:51

I am a fresh college grad student that just started my job. In my ramp up period, I need to learn a lot of product code. There are some design docs but they do not help much.

5条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-04 10:21

    Use every method available to you (in no particular priority):

    1. Use the product itself and understand what it does
    2. Talk to the devs that maintained it or have worked with it previously
    3. Debug through it and see how data flows and how classes interact ("when I click this button, what exactly happens, who is responsible?")
    4. Look at architecture, UML, or class diagrams
    5. One of my favorites: create your own diagrams of class hierarchies, class interactions, general control flow, high-level components, process/DLL interactions, object lifetimes and management
    6. If they're not totally out-of-date, read the dev/test/user specs (goes well with #1)
    7. Read the documentation on it

    Most of all: be tenacious and persistent. If you don't put in the work, don't expect to understand it. If you don't understand something, dig and dig until you do. Software is not magic, it's just hard work :)

提交回复
热议问题