Live data from Hacker News

Ask HN: How do you discover features in unknown code bases?

news.ycombinator.com

11–20 of 26 posts

Re: Ask HN: How do you discover features in unknown code bases?

#11
I would search WebKit, not chromium. But keep in mind that there’s a difference between “unknown code bases” and “one of the largest and most complex code bases ever created.” You’re asking, essentially, “in the Windows source code, where is the window layout algorithm?”

Stuff like that is certainly possible to find. But it requires a lot of time and dedication.

I would personally search for job listings for Chromium / Firefox, then use that knowledge to find someone who works on it. Then I’d ask them where it is.

But only in this specific case. My normal workflow is to build whatever it is I’m looking at, then change things until it breaks. It’s pretty quick to narrow down what I’m looking for at that point.

That doesn’t work here because building chrome requires close to a supercomputer.

EDIT: Actually, I would try to find a crash log related to the DOM. The stack trace will point you precisely where you’re interested in. Doing that is easier said than done, but I’ve pulled that trick a couple times, so it seems worth mentioning.

Re: Ask HN: How do you discover features in unknown code bases?

#12

I would search WebKit, not chromium. But keep in mind that there’s a difference between “unknown code bases” and “one of the largest and most complex code bases ever created.” You’re asking, essentially, “in the Windows source code, where is the window layout algorithm?” Stuff like that is certainly possible to find. But it requires a lot of time and dedication. I would personally search for job listings for Chromium…

>I would search WebKit, not chromium

Why? Blink is a fork of part of WebKit so it would likely even be in the same file.

Re: Ask HN: How do you discover features in unknown code bases?

#13
post #9

ripgrep But to not leave a one word answer, start searching for a feature you know about and look around from where you find it. It might help to add a super small feature yourself - when it finally works, you’ll have some idea of how the code is structured and will be able to infer where other features would live if they were there. (That might take a bit more than one addition ;)) In chromium’s case, what you’re tr…

Yup

- ripgrep when you know what you’re looking for already

- “find usages” when you’ve stumbled upon something interesting sounding, and want to see where it gets invoked (jetbrains ides)

- (gist.)github.com/search when you want to see how others have used some api

Re: Ask HN: How do you discover features in unknown code bases?

#14

I would search WebKit, not chromium. But keep in mind that there’s a difference between “unknown code bases” and “one of the largest and most complex code bases ever created.” You’re asking, essentially, “in the Windows source code, where is the window layout algorithm?” Stuff like that is certainly possible to find. But it requires a lot of time and dedication. I would personally search for job listings for Chromium…

>I would search WebKit, not chromium Why? Blink is a fork of part of WebKit so it would likely even be in the same file.

Smaller surface area. More likely to find tests related to the DOM being built. And as you say, once you find it in WebKit, you can probably find it in chromium.

Re: Ask HN: How do you discover features in unknown code bases?

#16
Version control can be a big help.

Look through closed tickets in the issue tracker, and try to find a change (bugfix or new feature) that must have, given its nature, touched the functionality you're looking for. Then try to find the changeset(s) where that ticket's change was implemented.

With some luck, the changeset will include a modification to the part of the codebase you've been looking for.

Re: Ask HN: How do you discover features in unknown code bases?

#17

I would search WebKit, not chromium. But keep in mind that there’s a difference between “unknown code bases” and “one of the largest and most complex code bases ever created.” You’re asking, essentially, “in the Windows source code, where is the window layout algorithm?” Stuff like that is certainly possible to find. But it requires a lot of time and dedication. I would personally search for job listings for Chromium…

How did you know it was in Webkit or Blink? What was your thought process that lead you to this conclusion? Was it prior knowledge?

Re: Ask HN: How do you discover features in unknown code bases?

#18
I'm no expert but currently currently getting into some coding after a bit of a break. Usually there is documentation, but you never know how relevant it still is. For this example with chromium, it looks like each folder has a readme.md, one even links to a dev wiki/guide and in there you can find google docs with diagram of the architecture :) For other projects there might be focus on doxygen which sort of collects the comments from the sourcefiles and puts it into for example html witch class trees etc.

Re: Ask HN: How do you discover features in unknown code bases?

#19
As well as poking around in the source code, do not discount non-source based approaches.

For example:

* Run chromium using strace, ltrace, gdb to see what's going on at runtime.

* Do some experiments / reverse engineering, treating the application / source code as a black box. Try different HTML input, inspect the DOM in chrome, possibly automate this process via selenium or something, and discover the runtime behavior of the algorithm that way.

The thing to keep in mind is that, for all you know, the DOM building algorithm is split across thousands of source files, or is in fact in some dependency and not in chromium itself, or is split across both. Presumably there is some particular aspect of the DOM building that you are interested in, so experiment with how that works, instead of trying to find / understand the entirety of chromium DOM building.

Post reply on HN