Understand Legacy CodeChange Messy Software Without Breaking It

Draw Dependency Graphs

A dependency graph is a directed graph that represents the dependencies of several objects towards each other. There are different flavors of such graphs.

The main question you need to answer is: if I touch this, what else would be impacted?

You can generate these graphs with a pen and a paper. Automated tools may be helpful but are usually cluttered with noise. Don't underestimate the low-tech approach to get started!

Techniques like the Mikado Method leverages such graphs. Concretely, it makes you discover the graph of tasks that needs to be completed before you can achieve your main goal.

🧰 Tools to draw them manually

🤖 Tools to draw them automatically

  • emerge covers many languages—I'm contributing to this one!
  • NDepend for .NET developers
  • SourceSpy for Java developers (it also allows creating manual diagrams)
  • deptrac for PHP developers
  • pydeps for Python developers
  • rubrowser for Ruby developers
  • madge for JavaScript developers
  • dependency-cruiser is also a great (and versatile) one for JavaScript developers
  • Sapling is useful if you work with React in VS Code

🎓 Related articles

Nicolas Carlo

Written by Nicolas Carlo who lives and works in Montreal, Canada 🍁
He founded the Software Crafters Montreal community which cares about building maintainable softwares.