# Tools to help me learn a big codebase

**URL:** <https://discourse.julialang.org/t/tools-to-help-me-learn-a-big-codebase/94855>\
**Category:** Tooling\
**Created:** [February 18, 2023, 10:50pm UTC](https://discourse.julialang.org/t/tools-to-help-me-learn-a-big-codebase/94855 "2023-02-18T22:50:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kingoslo](https://avatars.discourse-cdn.com/v4/letter/k/7cd45c/32.png) [@kingoslo](https://discourse.julialang.org/u/kingoslo)\
**Post date:** [February 18, 2023, 10:50pm UTC](https://discourse.julialang.org/t/tools-to-help-me-learn-a-big-codebase/94855/1 "2023-02-18T22:50:23Z")

</div>

This questions is about tools that will enable me to learn a big code base.

I have always worked on my own and without any collaborators. It has meant that I’ve never had to learn the source of a code base written by someone else. I expect this is a typical challenge for professional programmers, and that several techniques and tools exist to get an overview and navigate a big code in a way that is conducive for learning it. Typical problems I face are:

- If a function calls a number of other functions, which way can I piece together what it does? In particular when there are a dozen different definition of each function (because there are different input types) scattered all over the place, how can I find the the one that is relevant for a specific input type?
- If I don’t understand the types, and which is a subtype of what, how can I quickly get an overview of the hierarchy?

What are the necessary and sufficient tools that I will use to do this effectively?

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [February 18, 2023, 10:52pm UTC](https://discourse.julialang.org/t/tools-to-help-me-learn-a-big-codebase/94855/2 "2023-02-18T22:52:58Z")

</div>

For the first, Cthulhu.jl is really good. It is like `@edit` but gives you a repl that lets you explore the entire call graph (as well as track down performance issues like type instabilities).

---

<div class="post-metadata">

**Author:** ![jar1](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@jar1](https://discourse.julialang.org/u/jar1)\
**Post date:** [February 19, 2023, 5:58am UTC](https://discourse.julialang.org/t/tools-to-help-me-learn-a-big-codebase/94855/3 "2023-02-19T05:58:40Z")

</div>

> [@Way to plot graph of codebase? (i.e. function circles and dependency arrows)](https://discourse.julialang.org/t/way-to-plot-graph-of-codebase-i-e-function-circles-and-dependency-arrows/3450/5):
>
> Yeah, TreeView isn’t quite what you want, but it’s the closest thing I could think of at the time. Maybe just using the functionality in Base.Profile to build the call graph by sampling and visualizing it using [ProfileView](https://github.com/timholy/ProfileView.jl) is closer to what you need. But I was thinking a bit more about how to construct the call graph without sampling. I guess one thing you would need in order to get an actual call graph for a given function call is the ability to ‘dig into’ functions. So given e.g. function f…

---

<div class="post-metadata">

**Author:** ![jmair](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jmair/32/35117_2.png) [@jmair](https://discourse.julialang.org/u/jmair)\
**Post date:** [February 20, 2023, 12:59am UTC](https://discourse.julialang.org/t/tools-to-help-me-learn-a-big-codebase/94855/4 "2023-02-20T00:59:16Z")

</div>

I would recommend using debugging to work out what code does, as you can track the value of variables as it executes and go as deep/shallow as you like.

Start with finding an example in the docs of common usage and then use `@enter` before calling a function (available in VS code Julia REPL) and you can use step in, over or out to navigate through the code:

```julia
using ExternalPackage
@enter external_func(1234)

```

If the other code also has unit tests, they can be a good way to understand what the code is supposed to do. You can copy a unit test into a file and also debug through this code too.

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [February 20, 2023, 2:31am UTC](https://discourse.julialang.org/t/tools-to-help-me-learn-a-big-codebase/94855/5 "2023-02-20T02:31:51Z")

</div>

This is a good way of looking at the codebase graph: [FinEtools.jl/diagram.svg at main · PetrKryslUCSD/FinEtools.jl · GitHub](https://github.com/PetrKryslUCSD/FinEtools.jl/blob/main/diagram.svg)

It can be generated with a workflow described here: [GitHub - githubocto/repo-visualizer](https://github.com/githubocto/repo-visualizer)
