DEV Community

Discussion on: How do you orient to a "new to you" code base?

Collapse
 
tqbit profile image
tq-bit • Edited

It depends

For every project, I try and follow this flow:

  • Read the docs - get the most inconvenient thing out of the way first
  • Read the specs or latest customer requests Try and understand: what's the goal of this software? what's the expected behavior?

Only when I grasped the fundamental idea, I start exploring the codebase, usually in this order (Example for JS Projects):

  • Directory structure
  • File structure

That's enough to get an overview. Next:

  • Module dependency structure
  • Architectural pattern (e.g. MVVM, MVC)
  • Typings (if there are none, sometimes I create them myself with tools like JSDoc)

At this point, I usually grab the previous dev (if available) and ask him a few architectural questions.

  • Why does class A use method X?
  • What happened if I refactored function B into a util. module?
  • What breaks if I change this data structure?
  • Which dependant variables change if variable Z changes?

When I am able to apply the Software's goal to the code, I'm going into

  • Class definitions
  • Const definitions
  • Environment variable definitions
  • Function / method / class dependency structure

And then, sometimes I skip all of these and get to the last point:

  • Change a variable that 'feels' important and see what breaks

That usually puts me into the position to start with change requests