Live data from Hacker News

Ask HN: Working with large code base for the first time

news.ycombinator.com

71–80 of 90 posts

Re: Ask HN: Working with large code base for the first time

#71
Asking the team is something to be done with care. Yes, you should ask them for help, but ask them for holistic help. Don't go to a team member for every piece of code you need to find - ask them about the overall structure so you understand how things are organized, then find the details on your own. Ask "why?", not "how?"

It is a fine line between asking for help coming up to speed on a codebase, and asking for people to hold your hands while you do your job. Your team will help show you where they draw that line (each team is different.) But be aware of it because I have seen people fired for landing on the wrong side of the line.

I'm not saying to be afraid to ask for help - I'm saying to be sure to focus that help on learning and understanding, not trivia.

FWIW, I'm fully on board with all the answers that say, in short, "Search"

Re: Ask HN: Working with large code base for the first time

#73
post #52

1. Get confortable using “grep” [1], or better, “ripgrep” [2], which is quite faster than the former. They are both available in Linux, macOS, and Windows via WSL. 2. If the project uses a version control system (Git, Mercurial, Subversion, etc.) then take a look at the most recent additions, modifications, and/or deletions in the version control log (git-log, or whatever you want to call it). Sometimes, the most rel…

Tangential wish - I'd love it if someone figured out a good/generally working way of jumping to definition/references through a URL. E.g. from `axios.get(`/users/${currentUserId}`) in frontend code jump to `class UserSingleView: def get(self, user_id):` in the backend, and vice versa.

That is such an annoying thing in codebases. It's the same issue the other way around, I want to see all places in frontend that calls /v1/resource but then some people go and abstract the url into multiple variables.

If it was up to me the constant part of the relative url would never be abstracted away in the codebase. Just a simple grep would instantly get you everything you are looking for.

Re: Ask HN: Working with large code base for the first time

#74

1. Get confortable using “grep” [1], or better, “ripgrep” [2], which is quite faster than the former. They are both available in Linux, macOS, and Windows via WSL. 2. If the project uses a version control system (Git, Mercurial, Subversion, etc.) then take a look at the most recent additions, modifications, and/or deletions in the version control log (git-log, or whatever you want to call it). Sometimes, the most rel…

I should add `tig` for navigating git commit history. Very useful sometimes when working with many people on a git repo

Re: Ask HN: Working with large code base for the first time

#75
For a UI app, I think it's critical to first know how the app works from a user point of view. Then pick a (small) feature, and try figure out how it's rendered to screen by: - Read high level documentation (hopefully it exists) on the overall architecture, not deep-dives in the beginning - Find text that is rendered and tracing to where it comes from - Use the debugger; set breakpoints on client + server code to see the flow of data, particularly into lower layers that get data from DBs/APIs - Hopefully it's a TypeScript project and you can use an IDE to find references and otherwise navigate from symbols to see where functions/class/fields are used

Re: Ask HN: Working with large code base for the first time

#76
post #16

- Search for unique-looking strings from whatever view you're trying to modify to find the associated html/js file. - Pull up the commit history for the file to see what other files were modified along with it the last few times. This will give you dependencies and linkages. - Make your change and then ask your ide/command line to find all typing/lint errors in your project which will help you find other dependencies…

Thanks, didn't realize that you could pull commit history for a file.

Re: Ask HN: Working with large code base for the first time

#77
post #66

Ask, ask, ask. Yes, you can spend days or weeks poring over the code in various ways, but asking those who made it (ideally) or those who maintain it will give you the "why". Why was it done this way? What are the implicit assumptions and invariants? Why were seemingly obvious ideas not implemented? Or were they and found problematic? Document these findings for the next generation. But as you do this, keep an eye ou…

Realistically, i agree with your point and it's probably a good course of action! > Ask, ask, ask. Yes, you can spend days or weeks poring over the code in various ways, but asking those who made it (ideally) or those who maintain it will give you the "why". My question, however, is why aren't these things documented in the first place? In DevTernity (a recent software development conference), the concept of ADRs ( h…

In my experience, many things are documented, but the documentation is unhelpful, redundant or outdated. Sometimes there are several documents on the same thing, some are outdated in different ways, or the author has given up on it.

In code itself, often you see comments that say one thing, the function name saying another, and the relationship doing something different.

It's probably good company culture for seniors to just accept that the new guy will be a productivity sink for a while. Get them up to par quickly so they'll be productive earlier. Knowledge is like compound interest, it's easier to start them out with a lot and then have them figure it out rather than have them figure it out from the start and ask if stuck.

Re: Ask HN: Working with large code base for the first time

#79

1. Get confortable using “grep” [1], or better, “ripgrep” [2], which is quite faster than the former. They are both available in Linux, macOS, and Windows via WSL. 2. If the project uses a version control system (Git, Mercurial, Subversion, etc.) then take a look at the most recent additions, modifications, and/or deletions in the version control log (git-log, or whatever you want to call it). Sometimes, the most rel…

For IDEs, CTRL+SHIFT+F can be a good replacement for grep. There are similar shortcuts for Jump to Definition and stuff without installation needed.

Re: Ask HN: Working with large code base for the first time

#80
post #65
post #54

Earlier quoted context omitted.

I switched from using real IDEs to good old fashioned terminal wizardry precisely because I was working on big projects and my IDE was just getting too slow at that scale

intellij?

my CLion drives me nuts everyday because it's constantly re-indexing every time I switch branches. and the project isn't that large
Post reply on HN