Latest / DevQuestions with Tim Corey / 013 How Do I Learn to Read Code? Why Should I Learn to Read Code?
Transcript
- 0:00SPEAKER_00: Welcome to the Dev Questions Podcast with Tim Corey.
- 0:03SPEAKER_00: Join us each episode as we tackle the questions you are asking about a career in software development, understanding the industry, and new technology.
- 0:12SPEAKER_00: If you're just starting out or you want to grow stronger as a developer, this is the place to get your questions answered.
- 0:19SPEAKER_00: Now, here's your host, expert developer and online educator, Tim Corey.
- 0:25SPEAKER_01: Why is learning to read code that important?
- 0:29SPEAKER_01: How do I learn to read code?
- 0:32SPEAKER_01: These are just some of the questions that we're going to answer in today's episode of DevQuestions.
- 0:38SPEAKER_01: Learning to read code is essential to a developer's growth.
- 0:45SPEAKER_01: Let me back that up with some examples.
- 0:49SPEAKER_01: First of all, if you are a newly hired developer, so you just got hired full-time, you're all excited, great new job opportunity.
- 0:59SPEAKER_01: You walk in day one, do you expect them to have code already at that organization?
- 1:06SPEAKER_01: Or are you starting off with no code and you're gonna be the one starting them up?
- 1:10SPEAKER_01: Most likely, they already have a large code base.
- 1:14SPEAKER_01: They're hiring you to help them maintain that code base and improve it.
- 1:21SPEAKER_01: So when you walk in day one and they have this code base sitting there, lots of code, millions of lines of code, how do you get answers about how that code base works?
- 1:33SPEAKER_01: Well, one answer is by talking to fellow developers.
- 1:38SPEAKER_01: Maybe they already have somebody on staff, multiple people on staff that know the code base.
- 1:44SPEAKER_01: And that may be true, but sometimes it's not.
- 1:49SPEAKER_01: Or sometimes you have developers, but they're really busy because they have their own stuff to do.
- 1:55SPEAKER_01: They don't have time to spend the next six months teaching you everything about the code base.
- 2:02SPEAKER_01: So, how do you learn that code?
- 2:05SPEAKER_01: How do you understand it better?
- 2:07SPEAKER_01: Well, you have to look at that code, read it, comprehend what it's saying, and then from there learn to manipulate it.
- 2:18SPEAKER_01: One of the first things that that new developers at the company are often given is bug fixes.
- 2:23SPEAKER_01: This is a really easy way to get you up to speed on the code, because if something is supposed to do one thing and it does something else, then it's a lot easier to track that down than it is to say, hey, build this new feature.
- 2:40SPEAKER_01: But the reason why it's that that much easier is because of the fact that yes, you can build your own feature, but how do you integrate that into the whole?
- 2:50SPEAKER_01: How do you follow the same patterns?
- 2:52SPEAKER_01: How do you know what's available as far as a library of code goes?
- 2:56SPEAKER_01: And that's why fixing bugs is usually the place that people put new developers to the team.
- 3:05SPEAKER_01: So you have this bug.
- 3:06SPEAKER_01: Let's just say that there's an addition method somewhere, or the application is supposed to add two numbers together.
- 3:13SPEAKER_01: We're gonna keep it simple.
- 3:14SPEAKER_01: So the you pass in a three and a two, and you're expecting to get back five, but you get back 15.
- 3:22SPEAKER_01: Well, what's going on here?
- 3:24SPEAKER_01: Why is that doing that?
- 3:26SPEAKER_01: And so they give you this bug and say, okay, fix this.
- 3:30SPEAKER_01: You have to track down uh where the code is that supports the user interface.
- 3:37SPEAKER_01: Because the user's got a user interface, and they you probably will see a screenshot or something like that, where you see a you know a web application, it's got a box, two boxes, and they put three and two, they hit give me result, and it comes back 15.
- 3:52SPEAKER_01: So you see that, but then you gotta track down where does the actual addition happen, where do those numbers uh change, and what's going on.
- 4:04SPEAKER_01: Now, part of this is a debugging skill, the ability to track down and think like the the compiler and think like how a computer is going to process this code.
- 4:18SPEAKER_01: But with that, the more fundamental knowledge is how to read the code, how to understand what it's doing.
- 4:27SPEAKER_01: And we talked with this in a previous episode where we said that uh understanding how a code base works is a lot easier if you write good code, if you write code that is readable, not just optimized for the compiler, because code is meant to be read by humans.
- 4:52SPEAKER_01: So that makes it easier, but either way, you're gonna have to read through that code, understand what it does, and understand then from there how to fix it.
- 5:02SPEAKER_01: You can't understand how to fix something if you don't understand how it works, otherwise, you're just poking in the dark and hoping you push the right button.
- 5:11SPEAKER_01: That's not a good way of programming.
- 5:14SPEAKER_01: So learning to read code is important, but how do you do it?
- 5:18SPEAKER_01: How do you really grasp that concept of reading the code?
- 5:23SPEAKER_01: I'm gonna give you the answer that you hear from me a lot, and I feel bad saying it because there's a more nuance to it, but the reality is this is the answer for almost every question of how do I?
- 5:39SPEAKER_01: And the answer is practice.
- 5:42SPEAKER_01: How do I become a better developer?
- 5:44SPEAKER_01: Practice.
- 5:45SPEAKER_01: How do I learn to read code better?
- 5:47SPEAKER_01: Practice.
- 5:48SPEAKER_01: How do I go from a junior developer to a senior developer?
- 5:53SPEAKER_01: Practice.
- 5:54SPEAKER_01: Practice is the fundamental building block on which developers are made.
- 6:01SPEAKER_01: The more you practice this skill, the better you will get.
- 6:06SPEAKER_01: When I'm learning a new topic in C sharp, I don't always have a tutorial to read, especially when we're talking about cutting-edge stuff.
- 6:18SPEAKER_01: Blazor WebAssembly just came out not that long ago.
- 6:22SPEAKER_01: In fact, it was back in May.
- 6:24SPEAKER_01: This is uh August now.
- 6:26SPEAKER_01: It hasn't been out that long.
- 6:28SPEAKER_01: And yet I've been doing stuff with Blazor WebAssembly since before it launched officially.
- 6:34SPEAKER_01: Well, how did I learn what to do?
- 6:36SPEAKER_01: Did I just figure it out?
- 6:38SPEAKER_01: Or did I have some helpful tutorial to help me out?
- 6:42SPEAKER_01: Well, I had some tutorials because I went, I watched conference tutorials, but for the most part, I had to figure it out on my own because it's just cutting edge enough that there's not a lot of us developing content.
- 6:55SPEAKER_01: Now there is now, there's a lot more coming out, but even then, when people put content out, maybe it's not all the greatest.
- 7:03SPEAKER_01: Maybe it's not what you need, or it's not great developing or develop great code.
- 7:10SPEAKER_01: So there has to be a different way to learn C sharp, better a better way or a different way to learn these new topics.
- 7:19SPEAKER_01: And the way that that senior developers do this, the way that people that have been in this industry for a while, the way they do that, is not just by waiting for someone to tell them how to do it, it's by going and reading the code and then doing it themselves.
- 7:39SPEAKER_01: So, where do you get this code from?
- 7:41SPEAKER_01: Now, if you're being hired into a new company, you already know the answer to that.
- 7:46SPEAKER_01: That that code's right there for you to work on.
- 7:48SPEAKER_01: But when you're trying to learn a new topic and you're saying, you know what, I want to learn how to do X, whatever X is, how do I go about finding code for that?
- 8:00SPEAKER_01: Well, the great thing about living in 2020 is that GitHub is a massive repository of open source code.
- 8:12SPEAKER_01: It's code that you can read, that you can understand, and that will help you learn new topics because people are doing cutting-edge stuff with it.
- 8:24SPEAKER_01: Microsoft employees create demos in inside GitHub and open source them.
- 8:31SPEAKER_01: They provide this as a service to the community.
- 8:35SPEAKER_01: They say, here's a sample, and then you can go read that.
- 8:39SPEAKER_01: So there's a lot of code on GitHub you can look at.
- 8:44SPEAKER_01: But then once you get that code, how do you really read it?
- 8:48SPEAKER_01: How do you understand it?
- 8:50SPEAKER_01: And that's a that's a skill that comes over time.
- 8:53SPEAKER_01: I would encourage you to start small.
- 8:56SPEAKER_01: Pick small projects that do one thing that you think is kind of cool.
- 8:59SPEAKER_01: And look at that project, see how it works, watch it in action, and then look at the code and see if you can understand how that one piece works inside the whole code base.
- 9:12SPEAKER_01: This is a a skill that that I work on regularly.
- 9:17SPEAKER_01: Whenever I want to learn new code or new techniques, I go and read code.
- 9:22SPEAKER_01: And that's the other thing, too.
- 9:24SPEAKER_01: You're not gonna just learn new topics, you're also gonna learn new techniques.
- 9:28SPEAKER_01: You're gonna see how other people do it and say, Why don't I do it that way?
- 9:34SPEAKER_01: And so you can practice that, you can try it out.
- 9:38SPEAKER_01: You also will find new libraries.
- 9:40SPEAKER_01: People often ask me, Tim, how do you find all these NuGet packages?
- 9:45SPEAKER_01: You use these really cool NuGet packages in your tutorials that I've never heard of.
- 9:50SPEAKER_01: How did you hear about it?
- 9:52SPEAKER_01: And one of the ways that I hear about it, the most common way I hear about it, is by reading code from others.
- 9:58SPEAKER_01: They read their code and go, Well, you're doing data access, but using this other library.
- 10:03SPEAKER_01: Why aren't you using Dapper?
- 10:05SPEAKER_01: What it what library is that?
- 10:06SPEAKER_01: And I go and look at that library and say, Well, how is that different than Dapper?
- 10:10SPEAKER_01: And and how does it give me some benefits that Dapper might not?
- 10:14SPEAKER_01: Or maybe I'll look at the code and say, that's a cool pattern.
- 10:18SPEAKER_01: I see that and I see what it's doing.
- 10:20SPEAKER_01: I see it's really cool.
- 10:21SPEAKER_01: I I like the flexibility it gives me.
- 10:24SPEAKER_01: How can I incorporate that in my code?
- 10:27SPEAKER_01: You see, reading code will give you a much bigger picture on how development is done.
- 10:33SPEAKER_01: You will see how other people approach the same problems.
- 10:37SPEAKER_01: So while you're trying to learn a specific topic, you're gonna be exposed to other NuGet packages, other design patterns, and other philosophies of how to write code.
- 10:50SPEAKER_01: Some of it you're gonna say, I would never do that, or I want to avoid doing that, or I see the problem with that.
- 10:58SPEAKER_01: But some of it you're gonna look at and go, man, that's better code than I write.
- 11:02SPEAKER_01: Man, that's a that's a better way of doing things than I've been doing things, and you can incorporate what you've learned into your code.
- 11:10SPEAKER_01: So practice is really important because it will grow your skills in reading code, it will grow your skills in being a better software developer, it will grow your skills in what you know how to do, your your toolbox, as it were, of things you can do inside of C sharp.
- 11:33SPEAKER_01: This is something I'm I'm very passionate about.
- 11:36SPEAKER_01: Learning to read code is really important if you're a software developer.
- 11:41SPEAKER_01: In fact, I'm so passionate about it.
- 11:44SPEAKER_01: I actually created a new course series on this topic.
- 11:50SPEAKER_01: There's a new course series I'm creating, and this is not an ad for this necessarily.
- 11:53SPEAKER_01: I mean, go ahead and go buy it.
- 11:55SPEAKER_01: That's great.
- 11:56SPEAKER_01: But it just wants to illustrate just how much I believe in this.
- 12:01SPEAKER_01: I create a new course series called Exploring C Sharp.
- 12:05SPEAKER_01: And the idea is I want to teach you a new topic.
- 12:08SPEAKER_01: For example, the course coming out in a couple of days is called Exploring C Sharp Blazer Web Assembly.
- 12:17SPEAKER_01: And the idea is that yes, you want to learn about Blazor Web Assembly.
- 12:22SPEAKER_01: You want to learn more about how Blazor Web Assembly works and some of the cool pieces inside of it.
- 12:29SPEAKER_01: But I'm not gonna just say, here's five new cool pieces.
- 12:33SPEAKER_01: Go try these out.
- 12:35SPEAKER_01: I want to go deeper than that.
- 12:37SPEAKER_01: I want to train you how to learn about these on your own.
- 12:42SPEAKER_01: And so what we're gonna do is we're not gonna just learn about those five things in Blazor WebAssembly.
- 12:50SPEAKER_01: We're gonna find a sample project on GitHub.
- 12:53SPEAKER_01: We're gonna identify a project that does some cool stuff that we want to learn from.
- 12:59SPEAKER_01: We're going to fork that repository, which basically just means copy it.
- 13:03SPEAKER_01: And then we're gonna take that code, we're gonna get it running and see all the different pieces in action, see how they interact, see how they they fit together.
- 13:14SPEAKER_01: And then we're going to start looking at, hey, you know what?
- 13:18SPEAKER_01: That's a cool piece.
- 13:19SPEAKER_01: I want to pull that out and learn more about it.
- 13:22SPEAKER_01: And that over there, that's a cool piece too.
- 13:24SPEAKER_01: And so we pull apart five different pieces of Blazor Web Assembly stuff that we want to learn and say, let's learn about those five pieces in this project.
- 13:38SPEAKER_01: But the cool thing is, I was going over uh recently the things we're gonna learn in that course.
- 13:45SPEAKER_01: And yes, we learned about five different important topics in Blazor Web Assembly, including localization and and JavaScript interop, but that wasn't it.
- 13:55SPEAKER_01: That wasn't like the the uh the only thing we're gonna learn.
- 13:59SPEAKER_01: In fact, I had, I think it was like nine or 10 things beyond those that we're gonna learn.
- 14:07SPEAKER_01: So we're gonna learn like 15 important things in this course, and only five of which are Blazor Web Assembly, even though we spend the entire time focused on Blazor Web Assembly.
- 14:18SPEAKER_01: Because reading code provides you so much more benefit than just um just understanding a specific topic.
- 14:28SPEAKER_01: Yes, we picked out those five things, but because we did that, we learned 15.
- 14:34SPEAKER_01: We learned so much more than just about what we were focused on.
- 14:40SPEAKER_01: And that's why I am so enthusiastic about teaching you how to read code.
- 14:47SPEAKER_01: Because if you can grasp how to read code, if you can really focus on it and understand how to read code, then you don't need me as much.
- 14:57SPEAKER_01: And that's not, I don't want to ever be the I go away, but at the same time, I want to have you graduate beyond me.
- 15:05SPEAKER_01: I want you to be able to take the stuff that I do as bonus, as just icing on the cake, because you're already growing, you're growing beyond me, doing more than I can do because you're focused on reading code and understanding and growing on your own as well.
- 15:26SPEAKER_01: I don't want to be the limiting factor for you.
- 15:28SPEAKER_01: I want you to go beyond.
- 15:30SPEAKER_01: I have over 200 videos on YouTube on C sharp.
- 15:35SPEAKER_01: I have 15, 20 courses on imtimcorey.com that cover a ton of C sharp content, and yet I haven't touched the surface.
- 15:47SPEAKER_01: I have so much more to cover.
- 15:50SPEAKER_01: We have to cover microservices and Xamarin and Signal R, and that the list goes on of all these big topics with tons of stuff around them that I have to cover.
- 16:02SPEAKER_01: And I I desperately want to cover all these things, but I'm not always gonna be able to cover what you need me to.
- 16:11SPEAKER_01: And so this is a place where you can take how I learn from you, what I teach you, you can take it and not just learn that one specific thing, but grow beyond that to learning past what I can teach you.
- 16:28SPEAKER_01: So I would encourage you, learn how to read code.
- 16:31SPEAKER_01: It's gonna help you at your new job.
- 16:33SPEAKER_01: It's gonna help you as you work on an open source project.
- 16:36SPEAKER_01: It's gonna help you, even if you're just an uh animate developer who's doing this for a hobby.
- 16:42SPEAKER_01: Because you have to read your own code when you have a problem.
- 16:45SPEAKER_01: If you have a bug in your code, you're gonna have to read your code and figure out why that bug occurred.
- 16:51SPEAKER_01: And don't shortcut that process, learn from it.
- 16:54SPEAKER_01: So there's a lot of reasons why learning to read code is super important.
- 17:00SPEAKER_01: I would encourage you to practice, embrace those opportunities, look for more opportunities to learn how to read code because doing so will really grow you as a developer.
- 17:13SPEAKER_01: So that's it for this episode.
- 17:14SPEAKER_01: Thanks for listening.
- 17:15SPEAKER_01: I hope this was informative and helpful.
- 17:18SPEAKER_01: I hope that you're encouraged to read code, and I look forward to catching you on the next episode of DevQuestions.
- 17:27SPEAKER_00: Thank you for joining us for this episode of Dev Questions.
- 17:30SPEAKER_00: Tim is committed to making it easier for you to become a developer.
- 17:33SPEAKER_00: If you would like to help make more content like this possible, please like, subscribe, rate, and share Dev Questions.
- 17:40SPEAKER_00: You can also send your questions to questions at Iamtimcorey.com.
- 17:46SPEAKER_00: Until next time, remember, you are too smart and your time too valuable to waste it making all the mistakes Tim did.
- 17:53SPEAKER_00: When you're ready to learn to think and code like a professional developer, head over to IamtimCorey.com and enroll in a course.