Live data from Hacker News

Ask HN: How do you familiarize yourself with a new codebase?

news.ycombinator.com

241–246 of 246 posts

Re: Ask HN: How do you familiarize yourself with a new codebase?

#241

I wrote some simple bash scripts around git which allow me to very quickly identify the most frequently-edited files, the most recently-edited files, the largest files, etc. https://github.com/gilesbowkett/rewind it's for assessing a project on day one, when you join, especially for "rescue mission" consulting. it's most useful for large projects. the idea is, you need to know as much as possible right away. so you r…

Anybody knows a similar analysis tool for an SVN project? One option would be to convert the SVN to git for analysis purposes, but I'd be interested in a better solution.

never tried it myself, but you can take a look at the accompanying code "Your Code as a Crime Scene"

https://github.com/adamtornhill/code-maat

Re: Ask HN: How do you familiarize yourself with a new codebase?

#243

Earlier quoted context omitted.

Anybody knows a similar analysis tool for an SVN project? One option would be to convert the SVN to git for analysis purposes, but I'd be interested in a better solution.

never tried it myself, but you can take a look at the accompanying code "Your Code as a Crime Scene" https://github.com/adamtornhill/code-maat

Thanks! Gonna give this a try.

Re: Ask HN: How do you familiarize yourself with a new codebase?

#244

Earlier quoted context omitted.

What if you wrote a test that passes at the time of writing because of how something is implemented at that time but its not actually an invariant?

Then you will learn that later when the test fails. That is better because the reason for writing the test was your belief that it was invariant. Without the test you are more likely to continue holding the mistaken belief.

Sure, but that is an incorrect test for other developers to worry about it failing.

Re: Ask HN: How do you familiarize yourself with a new codebase?

#245
I use CodeMap[1] which is a kind of google maps but where the countries are the code, and CodeGraph[2] which helps to understand code dependencies at different granularities (package, module, files, functions). [1] https://github.com/facebook/pfff/wiki/CodeMap [2] https://github.com/facebook/pfff/wiki/CodeGraph

disclaimer: I am the author of those tools.

Re: Ask HN: How do you familiarize yourself with a new codebase?

#246
post #63

Earlier quoted context omitted.

You remove the printfs when you have fixed the problem.

It's so tempting to do this. Don't. Problems may occur again in the same area. Leave your logging statements around; configure your logging setup to skip them when you don't want them. You're saying to delete commented-out code once the new code works. Put your code in version control instead. Logging is to once-off printfs as version control is to commented-out code.

I do this far more than I should. The code ends up a mess after enough debugging like that.
Post reply on HN