Ask HN: What are the ways you go about getting comfortable with a new codebase?
61–69 of 69 posts
Re: Ask HN: What are the ways you go about getting comfortable with a new codebase?
#62As with most things depends on the code base, but if documentation in whatever form is available, I'd start there rather than just jumping into code. I'd start from the highest level abstraction of the code and work downwards until I reach a domain I'm either interested in or asked to work on and specialize on that vertical for a while (this can be anything from a few weeks to say 6 months). I then repeat the process…
Re: Ask HN: What are the ways you go about getting comfortable with a new codebase?
#63Two things - First - I learn how the data flows from the source to the end. That teaches me to navigate the codebase entirely. (User action to database, or source data to end data etc. Second - I learn how different components are wired together.
This reminds me of Pharo which does all of the above, indexes classes, messages and has a rich documentation support.
Re: Ask HN: What are the ways you go about getting comfortable with a new codebase?
#64Earlier quoted context omitted.
Hey, I'd like to get a grasp of how to do what you're explaining, would you have any link or resource by chance? thanks!
This is my favourite explanation of flame graphs: https://rbspy.github.io/profiling-guide/using-flamegraphs.ht...
Re: Ask HN: What are the ways you go about getting comfortable with a new codebase?
#65Three ways... 1. I go straight to the entry point, the main(), and then follow how the initial configuration, flow of data, sanitisation, and routing is done. 2. I look for bugs. Fixing bugs reveals the complexity as you need to look for side effects of the fixes when you don't yet know the system. Writing tests for those fixes also helps understand the system. 3. I look for the least changed part. I find these are u…
How do you think of #1 in the context of a web app? Each page is essentially a different entry point into the code. I guess the landing page or authentication page could be considered the equivalent, but I’m not sure those would hit your goals to understand flow of data, etc. ?
Re: Ask HN: What are the ways you go about getting comfortable with a new codebase?
#66Earlier quoted context omitted.
Very surprising! IIUC, you consider "Go To Definition"/"Go To References" and other "LSP assists" unhelpful (or worse) when familiarizing yourself with a new codebase. I personally find them indispensable. Could you say more to help me understand your position?
If I start with these tools I get a feeling I understand how things fit together, but when I want to add something new I realize my understanding is pretty shallow. I force myself to manually open files where things are so I get an understanding of the conventions and principles in the project. By far my most valuable tool is grep (it’s super fast in vim) and I grep the code to see where certain functions and such ar…
Re: Ask HN: What are the ways you go about getting comfortable with a new codebase?
#67Three ways... 1. I go straight to the entry point, the main(), and then follow how the initial configuration, flow of data, sanitisation, and routing is done. 2. I look for bugs. Fixing bugs reveals the complexity as you need to look for side effects of the fixes when you don't yet know the system. Writing tests for those fixes also helps understand the system. 3. I look for the least changed part. I find these are u…
How do you think of #1 in the context of a web app? Each page is essentially a different entry point into the code. I guess the landing page or authentication page could be considered the equivalent, but I’m not sure those would hit your goals to understand flow of data, etc. ?
Android introduced navigation graphs [1], which were meant to solve this problem. But what happened in reality were instead of arrows point to each screens, there would be multiple islands that were teleported in from random places.
[1] https://developer.android.com/guide/navigation/navigation-ge...
Re: Ask HN: What are the ways you go about getting comfortable with a new codebase?
#68Three ways... 1. I go straight to the entry point, the main(), and then follow how the initial configuration, flow of data, sanitisation, and routing is done. 2. I look for bugs. Fixing bugs reveals the complexity as you need to look for side effects of the fixes when you don't yet know the system. Writing tests for those fixes also helps understand the system. 3. I look for the least changed part. I find these are u…