How Do I Understand a Complex Codebase At Work?

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome to this episode of dev questions with tim corey join us as we tackle the questions you are asking about a career in software development understanding the industry and new technology if you are just starting out or you want to grow stronger as a developer this is the place to get your questions answered now here's your host expert developer and online educator tim corey how do i understand a complex code base at work maybe you start a new job and you're just trying to figure out what does all this code do how does it work what are these different modules how they bring how being brought into the code how does it interact how does it work at all and this is very difficult because the fact that you can't go to google and say how does my custom code my employer work because it's not on google so let's talk this through in today's episode of dev questions now this question was asked on the suggestion site and if you have questions that you'd like to see answered on a future episode of dev questions go to suggestions.iamtimcory.com and ask your question there so let's talk about integrating into a new code base understanding it learning it figure out what it does and how to start working on it now i think there's three initial steps that you need to go through now the first one is read the documentation if there's documentation read it through try to understand what it's talking about figure out what parts are useful because maybe not all the documentation is useful but try to figure out what's useful to you and understand it as best you can number two talk to the existing users what i recommend doing is every time you're not sure go ask a senior developer but take with you a notepad write down what they say try to make sure they understand that you're not going to just use them as your google that you are trying to learn once from them on each topic because usually people don't have a problem with you learning from them they want to make sure you're up to speed they want to help you where the frustration comes in is when you keep coming back with the same question so if you take notes if you write it down if you document what you have learned so you can go back to the document instead of to them that will definitely increase your ability to use them as a resource because they'll see that you are wanting to learn and grow and the number three place to look is unit tests look for unit tests in the project and see if they exist and if they do what do they test because those tests will tell you how specific methods are supposed to work so you'll see what the inputs and outputs should be based on expectations and then what they shouldn't be based upon what the rules are testing to make sure doesn't happen now is at this point you're probably thinking tim i have zero for three there is nobody in the previous position there is no documentation and i have of course no unit tests so what do i do because none of these exist and this is not an uncommon situation maybe it's a little bit uncommon to walk into a code base with no previous developers but it does happen but a lot of times there is no documentation there are no unit tests so at that point you're reliant entirely on the people that came before and maybe they're grumpy and don't want to talk to you so now you're still oh for three when it comes to learning this new code so what do you do well i have four self-discovery tips that i hope will help you so the first one is make sure that you have a development environment first don't do this in production okay but make sure you have a development environment if you don't talk to your boss and say listen i'm new i'm trying to learn i'm going to mess things up you don't want that in production right so help me help you so let's set up something where i can test things without breaking real things so get some type of development environment set up hopefully on your machine or something local where you can break it and not affect others and then practice try things out see what happens when you make changes just try it and see if things work or they don't work and why they work or don't work so that's number one get a practice environment and then practice number two step through the code if you're not familiar with how to do this use breakpoints so wherever you want to try to figure out what the flow is for something start at a very put a breakpoint the very beginning where you think it starts and then execute that step and see if the code breaks and if it doesn't you know that you have a bad assumption about where even the code started but then once you get the right spot you put the break point step through the code go step by step by step yes it can be a long process but understanding what each step does inspect the variables inspect how things change and take notes and track down what's going on with this code how is this flow through the application what are the things that looks through how to evaluate and understand how this code works so stepping through the code will really help you because that's the at the end of the day that's what your code is doing at much faster pace so if you understand that flow then you'll understand what your code is doing so that's number two number one is practice in a development environment number two is step through the code using breakpoints and other tools to help you understand that flow of the code number three write unit tests if you don't have any unit tests start writing them not just because you need to have unit tests not because you think that you know test driven development is the only way to go and you must have them don't be obsessed about this but instead use unit tests as your learning process create little tests and have them test a specific method for inputs and outputs make sure that the method does what you expect it to do by creating a unit test that tries it out and then if it doesn't do what's expected figure out why and if it's the unit test that's wrong or if it's the code that's wrong let's start writing the unit test to start practicing your understanding of the code this will do two things one it will help get you used to the code but two it will also create a system that'll make it easier to make changes the code because when you change code that's under unit tests the unit tests that we're working may break and if they do you realize the changes you made have fundamentally changed how the methods work which is probably not what was intended so by having these unit tests in place you're more likely to be able to change things with less fear so it really helps you in a couple different ways to create unit tests so that's number three and number four is document everything you learn even if you had documentation begin with even if you had co-workers that were willing to help you out even if you had existing unit tests still document what you learn either way it will be helpful for you and it will be helpful for the next person maybe they had documentation but it's kind of a date which happens improve it make changes make sure that you put the latest information in your documentation and share it with everybody then if someone reads over and says i don't think that's how it's supposed to be then you can grow together either they can say oh no you're right and they can understand better or they can help you with an assumption that you had that was incorrect so even if you don't have anybody there to help you there are steps you can take to learn and grow in a code base to better understand it now i know that some of this is going to seem like it's unattainable because of how long it might take you might say tim i just don't have the time to do that when i'm trying to get up to speed and fix problems but you can do some of this while you're doing that when you go to fix a problem write a unit test for it when you are trying to track something down document what you learn trying to track it down so there's things you can do along the way that will help your overall goal of understanding the system better and helping others including the person that comes behind you because at some point you'll be the person that knows a lot about your code base and they'll be the new person that doesn't understand and needs help if you can give them this information you can make it easier for them and you can reduce the amount of work it takes to get them up to speed which means you can reduce the amount of time it takes before you get help in your day-to-day job so it's really a win-win-win all around for everyone involved so those are the steps that i recommend for coming into a new code base trying to learn it and understand it and grow into it i hope that was helpful if you have a question again go to suggestions.iamtimcory.com and post your suggestion there or upvote an existing suggestion and hopefully you'll see your question answered here on dev questions in the future thanks for listening as always i am tim corey [Music] you
Info
Channel: IAmTimCorey
Views: 42,769
Rating: undefined out of 5
Keywords: c#, c# developer questions, dev questions, dev questions series, developer questions, how do i, iamtimcorey, learn c#, tim corey
Id: FErIfEd3IHI
Channel Id: undefined
Length: 10min 39sec (639 seconds)
Published: Thu Jun 02 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.