
Ask HN: How to get started with a very large code base? - kiloreux
I recently got started with a very large code base for a project, and I can&#x27;t find my way through it, the documentation is very bad, do you have any specific advice for getting started with such code base ? Any tips will be helpful.
======
jerf
Debuggers are great for this. Nothing will teach you like stepping through the
code. Do whatever it takes to get one working.

I recommend replying to your question with at least a _bit_ more detail,
particularly the language or languages in question and what the general
environment is. I could be more detailed for a few environments but I don't
want to just blindly guess.

------
stray
Write tests for every behavior the system currently exhibits.

Then systematically comment out everything -- one
function/block/class/whatever at a time -- making note of which tests break.

That should give you a better idea of how everything hangs together -- and
uncover the parts that aren't even used anymore.

Almost any software that you inherit, that has been around for a while, will
be a complete mess.

If you have time for a book, Michael Feathers' Working Effectively with Legacy
Code will likely help a lot.

~~~
jerf
"Write tests for every behavior the system currently exhibits."

That's often harder than just bashing your head against the problem.
Retrofitting code bases with any sort of unit testing is almost always a
challenge on its own terms... one much easier when one has at least an idea of
how it's working already. And that's after I apply the principle of charity
and downgrade "every behavior" to "many behaviors of interest".

It'd be great if it works, but I suspect it would only work when it's
unnecessary anyhow because any code base amenable to that treatment wasn't
that hard of a problem in the first place.

~~~
stray
I am of course, making the assumption that OP knows what the software _does_
\-- but not how it goes about doing it.

------
dev1n
I found this [1] in a comment where someone asked a similar question. This
really helps only if you are using a git repo though. There are some good gems
in this [2] thread too.

[1]:
[https://github.com/gilesbokett/rewind](https://github.com/gilesbokett/rewind)

[2]:
[https://news.ycombinator.com/item?id=9784008](https://news.ycombinator.com/item?id=9784008)

~~~
DrScump
I get -404 with [1]

------
DrScump
_Take notes_ (external to the code) on everything you learn about a given
module, whether code/flow analysis, insights on input / output / objects,
visible interactions, and what it reveals about how project-specific libraries
are used. Otherwise, it's so easy to have an "oh, _that 's_ what that does"
insight and lose it later because you assumed you'd remember it.

