TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

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

99 pointsby 2bor-2nover 3 years ago
I am working on on a very large codebase for the first time,mainly on the front end code. Needs some tips on how to trace down the code base effectively?

47 comments

guessmynameover 3 years ago
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.<p>2. If the project uses a version control system (Git, Mercurial, Subversion, etc.) then take a look at the most recent additions, modifications, and&#x2F;or deletions in the version control log (git-log, or whatever you want to call it). Sometimes, the most relevant files in a project are the ones people modify the most… obviously, ignore files associated to third-party dependencies (vendor, node_modules, that kind of stuff).<p>3. Install a Language Server Protocol (LSP) server [3] with support for the programming language(s) that you are going to use. Configure your favourite code editor to take advantage of as many LSP features as possible, with enphasis on “Jump To Definition” and “Find References” [4].<p>Tell us what programming language(s) is the project written in to give you more suggestions.<p>[1] <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Grep" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Grep</a><p>[2] <a href="https:&#x2F;&#x2F;github.com&#x2F;BurntSushi&#x2F;ripgrep" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;BurntSushi&#x2F;ripgrep</a><p>[3] <a href="https:&#x2F;&#x2F;microsoft.github.io&#x2F;language-server-protocol&#x2F;implementors&#x2F;servers&#x2F;" rel="nofollow">https:&#x2F;&#x2F;microsoft.github.io&#x2F;language-server-protocol&#x2F;impleme...</a><p>[4] <a href="https:&#x2F;&#x2F;langserver.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;langserver.org&#x2F;</a>
评论 #29646727 未加载
评论 #29646467 未加载
评论 #29646879 未加载
评论 #29648813 未加载
评论 #29647086 未加载
评论 #29650355 未加载
评论 #29646830 未加载
评论 #29657615 未加载
frobover 3 years ago
- Search for unique-looking strings from whatever view you&#x27;re trying to modify to find the associated html&#x2F;js file.<p>- 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.<p>- Make your change and then ask your ide&#x2F;command line to find all typing&#x2F;lint errors in your project which will help you find other dependencies you may have missed.<p>- If you get stuck, reach out to the authors or reviewers of previous PRs. (Hint: you may want to include them as reviewers. They&#x27;ll give good feedback and you&#x27;ll engender good will by keeping them in the loop when you touch their corner of the codebase)<p>- Write a few solid unit tests. Maybe even clean up the testing code a little bit while you&#x27;re there.<p>- Write a concise but informative description of your changes in your PR. If you made two or more logical changes, split your PR and stack them. Your teammates will appreciate the shorter PRs and you will get feedback more quickly.<p>- Land the PR in a timely manner and keep an eye on it until it hits prod.<p>- Once in prod, test it yourself and keep an eye on the logs for a day or three.<p>- Bonus: put all changes behind feature flags to do slow rollouts and so you can quickly revert without waiting for a deploy. Make a task to remind yourself to remove the dead code behind the flag in month or so when you&#x27;re pretty sure it&#x27;s stable.
评论 #29650150 未加载
abridgettover 3 years ago
I&#x27;m a firm believer that the onus should be on the current development team to explain this to you. That is unlikely IME to happen without you asking.<p>What happens next will be an iterative process.<p>Do some initial investigation - don&#x27;t waste time figuring things out, we just want a set of questions and areas to explain at this stage.<p>Ask for some help from the team - perhaps 30-60 mins, perhaps with different people to cover off the topics. It&#x27;s essential that the team contribute - firstly they owe it to you, secondly only they know the background. Which bits of the codebase were experimental, which bits are ancient relics being removed, what&#x27;s the direction of travel, which parts have subtleties. &quot;Unknown unknowns&quot; (to you).<p>Now &quot;pay it forward&quot;. Ensure that the next person to join the team has a better time. Maybe this is writing some documentation - be it architectural, a glossary of domain-specific terms, updating&#x2F;culling outdated docs. Maybe parts of the codebase could do with some re-organising or renaming to make it more self-evident. Perhaps the build&#x2F;test process could do with some care...<p>I&#x27;ve done this several times, and after 3-4 hour sessions with &quot;the one person who understands&quot; (and a few hours writeup), we now have good documentation, better standards and multiple people including new joiners who understand. The guru also appreciates having more people to bounce ideas around with and no longer being overloaded with this work.
评论 #29653678 未加载
larsrcover 3 years ago
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 &quot;why&quot;. 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.<p>But as you do this, keep an eye out for assumptions that may have changed. A feature now obsolete requiring weird code. Out-of-date assumptions about the behaviour of computers or other systems. New language features that can simplify or improve code. Talk them over with the people who know the code, and maybe you&#x27;ll be the one to delete that awful code everyone hated.<p>Also, take notes, not just about the code, but about its environment, release process, surrounding systems, use cases, and people. Knowing who to ask about a given issue is gold.<p>If there are post-mortems available, they can give a great insight into how the system works and fails. Design docs to a certain extent, too, but they can be misleading especially if they are not kept up to date.<p>Pair programming can be a very effective way of learning, too.
评论 #29648064 未加载
clktmrover 3 years ago
- Before starting to dive into the code, take a look at it from the users point of view. Make sure you know what the code does by reading manuals and playing around with it.<p>- Don&#x27;t try to learn domain knowledge from the code. I you need to get familiar with code of a JPEG decoder, learn how JPEG works first.<p>- Before reading code, make sure you can jump to definition and find references. The easiest and language agnostic way is to use ctags and grep.<p>- Start reading code from main() (or an API call in the case of a library) and then start to dig deeper. This way will get a feeling where the &quot;important&quot; code is&quot;
peterhuntover 3 years ago
Shadow a more experienced engineer and ask them lots of questions.<p>One of my favorites is “how did you know to do that?”
评论 #29646775 未加载
zergovover 3 years ago
I like to trace down things in order.<p>For example, let say I&#x27;m working on an ecommerce system and I try to understand what happens when a buyer adds an item to its cart. I&#x27;m going to put logs &#x2F; debugger&#x27;s prompts on the important steps of that operation. Next to those, add a comment that describes why this step is important. The important thing is to label the comment with incrementing numbers. Those numbers allow me to keep track of the order of execution.<p>Finally, commit this to a dummy branch and share it with your co-workers if both of you are new to this code base.<p>That&#x27;s one of the first thing I do when I jump in a new codebase. Pick something that interests you, and log the whole operation.
yuchiover 3 years ago
If the project you are working on has enough time to burn, and the codebase has no (or near to) unit tests, add them.<p>Find large utilities that are not coupled with a particular part of the application, and put them under heavy testing. Do not fix any failing test before having completed the test suite.<p>If you have access to other developers that know the codebase, review the tests with them, and fix failing tests together.<p>Do the same for the frontend &#x2F; interface code, but do not go for unit testing imho, go for visual regression testing.<p>And the end of the process you will have a very large knowledge of the codebase, and you will have improved it at the same time.
评论 #29646278 未加载
olodusover 3 years ago
Maybe I missed it but I don&#x27;t see anyone mentioning Git blame. It is great tool to see how recently some part of the code you are working on were changed and by who, so you know who to ask. Also good to know what kinds of commits happens in your part of the code (if it is a good commit it probably describes what problem they were trying to solve). Hook it up to your IDE&#x2F;editor (guessing it works with most of them, I have it hooked up with my vim) so you can see which lines changed in which commits.
mtoddsmithover 3 years ago
You should be able to break down a front end project by documenting of all the pages and then components they depend on. Then document their flow (which pages link to which and what dialogs &#x2F; components they open). Then you need to look at how data is managed among all the pages and components. Do they use something like redux for data management? Then how is the business logic is composed and how backend API&#x27;s are used. Also for a front end project how are styles managed through out the application.
评论 #29645974 未加载
8organicbitsover 3 years ago
It&#x27;s going to take time, for large code bases you won&#x27;t actually look at all the code.<p>Make sure you&#x27;re able to efficiently navigate through the code. If your IDE supports jumping to declarations and usages, make sure you get working.<p>Look at old commits to see how changes were added before, that will hint at how future changes should look.<p>Ask others for help if something doesn&#x27;t make sense.
Flankkover 3 years ago
What you need, more than anything, is the mental model the authors used when writing it. In a company you want to sit down with the people who wrote it. If it&#x27;s open source you&#x27;ll have to do the same if the API is undocumented. Otherwise it&#x27;s something like unbaking a cake. I&#x27;ve done it myself by first figuring out the dependency tree of the modules, then trying to get a high-level idea of the purpose of each component. From there, it should become easier. If the code is written with any sense at all it will get lower-level and less abstract as you work your way down to the function calls.
eyelidlessnessover 3 years ago
These are not rote advice, it’s literally the parts that have been successful as I’ve inherited maintainership of several large projects.<p>If it’s not already TypeScript, add a tsconfig.json, with allowJs: true, checkJs: true. You’ll probably need some tweaks from there. But merely adding the config is enough to kick VSCode or other language service providers into finding references and a lot more.<p>Apart from that:<p>- Keep notes as you uncover how things flow and interact.<p>- The best way to keep those notes is as part of your project’s documentation. Use JSDoc and TypeScript declaration files. Learn how these docs interact and aid navigation.<p>- @see is a particularly useful JSDOC tag!<p>- Speed up the build if it’s slow. No really, it’s going to help with discoverability in the codebase! Breaking flow to wait for a build is a sure way to lose track of your journey.<p>- Backfill tests before you touch implementation. Even if you suspect the tests might be redundant. Odds are they’re not, but even if they are, (1) that’s more documentation you can reference and (2) any other maintainers&#x2F;contributors seeing redundancy can use that as a signal to shortcut your familiarization.<p>- Git blame is your friend. Some days it’s your best friend.<p>- Look in weird places! Sometimes that old version of a dependency is pinned for a reason. Sometimes it’s pinned to a fork, again for a reason.
codingdaveover 3 years ago
Asking the team is something to be done with care. Yes, you should ask them for help, but ask them for holistic help. Don&#x27;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 &quot;why?&quot;, not &quot;how?&quot;<p>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.<p>I&#x27;m not saying to be afraid to ask for help - I&#x27;m saying to be sure to focus that help on learning and understanding, not trivia.<p>FWIW, I&#x27;m fully on board with all the answers that say, in short, &quot;Search&quot;
ybluover 3 years ago
Debugger is your friend :)<p>Start by adding breakpoints for some key actions of the app. Then step through the flows with the debugger. First pass you can just step over functions to get the high-level idea. In subsequent passes, you can step into functions that seem important. Rinse and repeat until you understand those actions well. Then move on to other areas in the app.<p>This works because you can see the actual end-to-end execution flow (not always clear from reading code), inspect runtime data (impossible by reading code) and even change the runtime data (variables, DOM) to validate assumptions about how the code works.
run2arunover 3 years ago
Find out how to run unit tests in your project and then find interesting unit tests to run. Set break points preferably at some launch points of your code and debug through unit tests. The process will take you through relevant parts of the code, the decisions being made etc.<p>This method has also worked for me when building features in a large codebase. Write a unit test first and then keep checking where the code breaks and fix those until your test succeeds. This is effectively TDD. Note that you might have to refactor the code for better design but it gets you started towards understanding the flow.
mym1990over 3 years ago
This is an incredibly broad question, and the answers will probably be all over the place. If you are working on the front end, try to find the entry points and work from there through various hypothetical scenarios. Hopefully there is documentation on various parts of the system, or architects&#x2F;devs who built it, but that is unfortunately not always the case…<p>Find out the deployment process. Find out what to do if anything goes really, really wrong. Try to find patterns in the code. Just explore for a while and even try to create you own mental model of how things are structured.
lkrubnerover 3 years ago
For classic backend server software, for years I found the best way in was to look at the database schema, to understand those relationships, and then to see how the software itself was segmented (or not) in its relationship with the different parts of the database. If it was easy to understand the segments, and their relationship to the database, then I could assume that the software had good module interfaces with clean separation, but if every module was a mix using data from the same database tables, then I assumed I was dealing with a problematic code base that lacked good clean interfaces.<p>When dealing with frontend code, my attitude remained the same, but instead of looking at the database, I&#x27;m typically looking at the API. The goal is to see how data flows through the app. That is certainly one way, for understanding the code. This used to be easier, with classic RESTful APIs, I find this approach is a bit more difficult when using GraphQL.<p>Also, just to state the obvious, run the unit tests. If the code base lacks good test coverage, ask if you can start there, writing more tests -- that will give you a purpose and a structured way of diving into the code. I also suggest that you deliberately break things, and then see which tests fail -- if a test fails and you weren&#x27;t expecting it to fail, then you just discovered a linkage in the code that you didn&#x27;t think would be there.
missblitover 3 years ago
A codebase has a time dimension, and utilizing this effectively is critical.<p>Not sure when a bug was introduced? Write a test then bisect (if you can&#x27;t automatically bisect frontend code you have other problems, but manual bisects work in a pinch).<p>Not sure why something was written the way it was? Hey sometimes this stuff just evolves naturally, try looking back through blame history to see how different commits effected the code.<p>Not sure what needs touching to add a new feature? Try seeing if you can find a similar feature that someone else wrote in the past.
jollybeanover 3 years ago
The architectural overview, either from the docs or from someone who can tell you, which gives you the &#x27;lay of the land&#x27; and a rough idea of what does what. Like having a map.<p>Then, the custom idioms and weirdness that develops in every project, often it&#x27;s a set of patterns that the team just &#x27;acquires&#x27; - often it&#x27;s in every file, every function. It&#x27;s like learning &#x27;words&#x27; specific to the language they have created for themselves.<p>Then get someone to explain the build systems, tooling etc..<p>And then, just of the sake of it - make sure to build it. Make a change and build it again. I think there&#x27;s a weird leap in subconscious confidence that comes along with &#x27;building it&#x27;. Like riding a wild horse for the first time, if you can do it for one second, you can do it for longer.<p>Once you have you head wrapped around the system, and the &#x27;systematic things&#x27; (like idioms) and can navigate the tools ... then it a matter of breaking thing down into details. Which is where the work is of course.<p>But you need a &#x27;map&#x27; and a &#x27;cart&#x27; and your &#x27;hammer&#x27; before you can start waltzing around Campus thinking about fixing things.
cainover 3 years ago
Logging to console, to build a mental model of the codepaths data and events take.<p>Git grep (or ripgrep) to find usage - useful when refactoring and to see how data is used&#x2F;accessed and where it&#x27;s passed around. Also useful to note where certain data doesn&#x27;t show up: you can infer some structure from this.<p>Looking at when something was last changed with git blame can be useful. Is something suddenly broken, but hasn&#x27;t been changed in 5 years? Could give an indication of where not to look on a first pass.<p>Break some things (locally) on purpose. Get a feel for how errors bubble up through the application and how dependant code behaves when something is wrong.<p>Look over the last handful of PRs&#x2F;merged patches. It can be helpful to see these smaller pieces of code, the changeset, and their associated context - whether it was a feature, a bugfix, and what the code was supposed to achieve.<p>Use existing code in the codebase as a styleguide. <i>Most</i> work on large codebases isn&#x27;t groundbreaking or innovative, so you&#x27;re likely to find existing code similar to what you&#x27;re currently trying to achieve that you can use to guide you.<p>If possible, make use of code reviews with colleagues.
shiohimeover 3 years ago
- Definitely use an IDE like IntelliJ<p>- Familiarizing yourself with vim is great and one of the best timesaving skills I decided to pick up randomly. You can install vim plugins for most IDEs<p>- Pick a small feature that you are curious how it works, and focus entirely on how it was implemented. The simpler the better really. Use git history to see the commit that the feature was introduced, and look how that engineer implemented it. It&#x27;s quite easier for me to learn how something works by just focusing on seeing the Pull Request for the implementation. Just focus on looking how various things were implemented, and you&#x27;ll (hopefully) see a pattern in code practices &amp; design patterns.<p>- If you have questions, you should feel free to ask other engineers that work on the project. I was in a pretty senior position at my last job and we had quite a large codebase, and I personally never minded helping out junior and new engineers ever when they were coming up to speed on a new codebase. I always took the viewpoint that it&#x27;s always in my best interests to help out the newer team members get up to speed quicker and have a better understanding of the product so they are able to effectively contribute. Hopefully engineers on the project you are working on think similarly.<p>- Absolutely learn how to perform proper debugging if you are not familiar already. Learn how to hook the browser to your IDE, how to troubleshoot things on the backend if you get to the point where you&#x27;re doing fullstack work. Effective debugging is an incredibly important skill to pick up.<p>- Learn how to use IDE &#x2F; other editor tooling such as jump to definition, refactor, inspect, find all occurrences. If this is a react project learn how to use browser extensions like devtools to help with debugging and understanding document structure.
评论 #29647526 未加载
omgitsabirdover 3 years ago
WebStorm is a good IDE for static analysis and understanding connections between modules and procedures. You can click your way through the call stack with decent accuracy.<p>A lot of people in this thread are recommending grep and ripgrep, but you do not have context with those tools, so it isn&#x27;t as helpful, imo. With an IDE, you can find usages of symbols, trace connections, build graphs, etc.
qiqitoriover 3 years ago
If it&#x27;s C, cflow (example usage: cflow <i>.c </i>.h) and doxygen (needs some config, but there&#x27;s a GUI) could come in handy. Doxygen is capable of generating call graphs if you install some external dependencies.<p>If it&#x27;s a different language, you could try looking around in the docs if anyone&#x27;s generated callgraphs, or you could look up ways to do so.<p>To trace the code you could use a debugger -- e.g. if it&#x27;s gdb just issue the command &#x27;start&#x27; and then step through from the main function to see how things go. Or (assuming it&#x27;s something like a C program) you could get an strace (example usage: strace -vvvttf -o strace.log .&#x2F;program) and maybe get a feeling for the config&#x2F;etc. files read or written to, network services accessed, etc.<p>It would help if you could tell us what kind of program it is, or what kind of programming language it&#x27;s written in.
splittingTimesover 3 years ago
Play with the application. In each of the main views try to find prominent&#x2F;unique label strings. Search for those labels in the code base to get an entry point to the view. Then explore the code around that entry point and try to change something here and there and see if it has the effect you expected.<p>Other then that there is not much to that you would not do in other code bases as well. Set up your IDE probably do you have all the linters ready and can easily navigate the code base.<p>Ask your lead or mentor to show you the low prio backlog Tickets that have 1 or 2 story points and start the to get your feet wet. Once you have solve one, ask how your commit process works and follow it. Rinse and repeat three times then pick a ticket from the Sprint filter and start contributing.
deergomooover 3 years ago
What I find more useful than anything else is to find the entrypoint to the code you’re interested in, set a breakpoint on the first line, and step through with a debugger.<p>IMO it’s by far the fastest way to understand how an application bootstraps itself and produces its output.
JonoWover 3 years ago
For a UI app, I think it&#x27;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&#x27;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&#x2F;APIs - Hopefully it&#x27;s a TypeScript project and you can use an IDE to find references and otherwise navigate from symbols to see where functions&#x2F;class&#x2F;fields are used
booleanbetrayalover 3 years ago
Assuming sourcemap pipelines work, open your browser and put debuggers on anything you don&#x27;t understand tracing requests &#x2F; invocations. Start with something conceptual like a particular page &#x2F; component and work your way out beginning at the request entrypoint. Along the way you will likely figure out things like authentication management, routing, view hierarchy and design patterns leveraged, etc. Allow a particular issue you need to resolve guide you if needed, but don&#x27;t sweat the learning curve, as it is required and should be expected.
lelanthranover 3 years ago
I like sourcetrail (<a href="https:&#x2F;&#x2F;www.sourcetrail.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.sourcetrail.com&#x2F;</a>). Sadly, in my latest position I have a Mac and I cannot get it to work on a Java project, as it complains that it cannot find a JRE at the $JAVA_HOME path that I specify (which works for all the other projects, including IntelliJ).<p>Maybe between Christmas and New Year I might have some time to figure out what is wrong.
评论 #29646519 未加载
fn1over 3 years ago
* Use an IDE (Like IntelliJ Idea)<p>* If there&#x27;s no architecture-document that gives a short (3-5) page overview on the layout of the code then start writing one.<p>* Skim through the folders &#x2F; packages &#x2F; classes and write down a few obvious questions that pop into your mind while &quot;speedreading&quot; the code.<p>* Try to make an improvement to see how the whole CI&#x2F;CD process works.<p>* Look through the list of direct dependencies &#x2F; libraries and see where they are used.
KronisLVover 3 years ago
If you use Git, Mercurial, Bazaar or SVN and would like to visualize where most of the recent effort of development has gone into and what people have worked on the most, have a look at something like Gource: <a href="https:&#x2F;&#x2F;gource.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;gource.io&#x2F;</a> In my eyes, those visualizations are really nice for an overview of how the project has evolved.<p>Personally, i&#x27;ve also had good experiences with Sourcetrail, for seeing how bits of code fit together within a codebase, although the development on it has ceased recently: <a href="https:&#x2F;&#x2F;www.sourcetrail.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.sourcetrail.com&#x2F;</a><p>Also, some are recommending text editors with plugins or specialized tools, but i&#x27;d also like to suggest just getting a really good IDE that&#x27;s integrated with the tech stack that you use. Personally, JetBrains fills that niche for me: <a href="https:&#x2F;&#x2F;www.jetbrains.com&#x2F;products&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.jetbrains.com&#x2F;products&#x2F;</a><p>Depending on the language and framework support, it can lead to an amazing development, refactoring and testing experience, albeit has some drawbacks in comparison to text editors like Visual Studio Code - it uses more memory and CPU resources (especially when indexing the project, a tradeoff that most IDEs out there make in one way or another) and also is a paid product, i just got the Ultimate package of all tools for my personal and work needs.<p>Apart from that, i&#x27;m not even sure - jumping around definitions in source code and seeing how different things are connected, what the dependency graphs are like and so on is nice, but understanding why things were built that way might require ADRs (<a href="https:&#x2F;&#x2F;adr.github.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;adr.github.io&#x2F;</a>) which many companies still don&#x27;t use, or trudging through issue management systems (like seeing what issue a piece of code was developed under, then reading the user story in Jira etc.). Or course, having READMEs and automated scripts for project setup or common actions in it, ideally versioned alongside the code, can also be really nice!<p>Personally, i think that we as an industry would benefit a lot from more focus on DX (developer experience), both in regards to tooling to explore codebases, as well as practices in regards to documentation for the actual devs to use and dogfood.
wwilimover 3 years ago
Contrary to what the terminal wizards might tell you about configuring vim, tmux and using grep, just install a real IDE
评论 #29647386 未加载
评论 #29647120 未加载
jaredsohnover 3 years ago
To find the frontend code associated with a feature, search the view code for text that you see in the app.<p>To see how it uses the backend, open the network tab in Chrome developer tools (or equiv in other browsers), look at what requests it makes, and then find corresponding controllers within the code.
hboonover 3 years ago
Look for distinct patterns and code boundaries&#x2F;modules.<p>Look at git commit (messages) and issues&#x2F;PRs. Which parts of the codebase&#x2F;process is involved in making which type of changes.<p>Any codebase, especially large ones, may not be consistent during to legacy and many reasons.<p>Use an IDE + grep&#x2F;ag.
muzaniover 3 years ago
I&#x27;d actually recommend reading the whole thing quickly and frequently. No note taking needed. It&#x27;s like playing scales on a guitar. Do it first thing in the morning for a few weeks, start out from different files.
hunter2_over 3 years ago
From the root of the repo:<p><pre><code> grep -HIron &#x27;your search pattern&#x27; * </code></pre> Sometimes I&#x27;ll add -i (case-insensitive), or drop the -o (for some context but beware minified files), etc.
评论 #29647090 未加载
thrower123over 3 years ago
Jetbrains WebStorm has find usages and goto definition features that actually work correctly most of the time, even for Javascript. It&#x27;s a big step up from just grep&#x27;ing strings.
gtsopover 3 years ago
Step 1: Ask the previous programmer if available.<p>Step 2: Document their knowledge
dupedover 3 years ago
Ask your coworkers when you have questions about how&#x2F;why&#x2F;where&#x2F;what something is in the code base, they&#x27;re the best tools you have
do_anh_tuover 3 years ago
Usually large codebases have to follow the best practice of the framework they use. If you already fluent in that framework, you can jump right in.
perlgeekover 3 years ago
What about other people working on the same code base? Can you make them give you run-down of how things are structured?
yellow_leadover 3 years ago
When you&#x27;re doing you&#x27;re tasks, look at other ways similar work has been done throughout your codebase.
amiamigoover 3 years ago
I suggest you try JetBrains IDEs depending on your tech stack. They have got an incredible search capabilities. You can search for a word&#x2F;function where it has been used across project, you can find and replace across the project, etc. It&#x27;s amazing!
评论 #29646293 未加载
评论 #29646657 未加载
factorialboyover 3 years ago
Invest in tooling, Jetbrains IDEs have served me well.
ThouYSover 3 years ago
I&#x27;ve made very good experiences with Sourcetrail
评论 #29646237 未加载
chrislloydover 3 years ago
Attend incident postmortem meetings.
whateveracctover 3 years ago
ripgrep :)