News for hackers. Stuff that matters.
Re:Ask HN: How do you familiarize yourself with a new codebase? by kabdib on Friday June 26, 2015 @10:01AM (#9784371)
I just crack open the source base with Emacs, and start writing stuff down.

I use a large format (8x11 inch) notebook and start going through the abstractions file by file, filling up pages with summaries of things. I'll often copy out the major classes with a summary of their methods, and arrows to reflect class relationships. If there's a database involved, understanding what's being stored is usually pretty crucial, so I'll copy out the record definitions and make notes about fields. Call graphs and event diagrams go here, too.

After identifying the important stuff, I read code, and make notes about what the core functions and methods are doing. Here, a very fast global search is your friend, and "where is this declared?" and "who calls this?" are best answered in seconds. A source-base-wide grep works okay, but tools like Visual Assist's global search work better; I want answers fast.

Why use pen and paper? I find that this manual process helps my memory, and I can rapidly flip around in summaries that I've written in my own hand and fill in my understanding quite quickly. Usually, after a week or so I never refer to the notes again, but the initial phase of boosting my short term memory with paper, global searches and "getting my hands to know the code" works pretty well.

Also, I try to get the code running and fix a bug (or add a small feature) and check the change in, day one. I get anxious if I've been in a new code base for more than a few days without doing this.

Re:Ask HN: How do you familiarize yourself with a new codebase? by rymndhng on Friday June 26, 2015 @12:32PM (#9785820)
Totally agree with the point of pen/paper.

Something that compliments that approach is in-code annotation. Recently, I've recently been trying out https://github.com/bastibe/annotate.el which is pretty sweet. Check it out!

Re:Ask HN: How do you familiarize yourself with a new codebase? by john2x on Saturday June 27, 2015 @12:33AM (#9789117)
Off topic, but anyone know what font and theme (it looks like the default theme but I'm not sure) are used in the project's screenshots?
Re:Ask HN: How do you familiarize yourself with a new codebase? by systemfreund on Saturday June 27, 2015 @02:31PM (#9791082)
The font is PragmataPro, which I am also using. Best font ever, but expensive.
Re:Ask HN: How do you familiarize yourself with a new codebase? by kabdib on Friday June 26, 2015 @04:35PM (#9787572)
annotate.el looks pretty interesting, thank you.
Re:Ask HN: How do you familiarize yourself with a new codebase? by humbleMouse on Friday June 26, 2015 @10:41AM (#9784686)
I work similar to this. I love writing things in notebooks. I also like making diagrams on draw.io and printing them out for reference/writing on.
Re:Ask HN: How do you familiarize yourself with a new codebase? by webhat on Friday June 26, 2015 @04:35PM (#9787578)
I go as far as to have a dedicated project notebook for big new projects, I write everything down that I come across that I need to remember or need to question.

I've often been dropped into codebases where there is only a month to question the previous maintainer before all the business knowledge is lost as they move on to bigger and better things. So getting all the questions/queries down asap is the fastest step to get the undocumented business logic documented.

Even when you can't ask the questions I like to turn all the unknown unknowns into known unknowns. :)

Re:Ask HN: How do you familiarize yourself with a new codebase? by joe_the_user on Saturday June 27, 2015 @12:12AM (#9789071)
Great points Also,

A list of the kinds of broad abstractions to look for might be useful;

* Each module and it's purpose

* Every global resource (whether global variables, message names, anything that the entire system has to deal with).

* The "style" that each coder used. Even "terrible" programmers tend to have a consistent approach and understanding that approach can make code much less opaque.

I also like to page though documents more quickly than my conscious mind can follow so as to get an unconscious feel for a code base. That might be just me.