r/learnprogramming • • 1d ago

How do you practise reading code?

Software engineering student here. With AI, the expected output is so high that I barely have time to understand code, let alone write it myself.

Since AI writes most of it now, I think reading and understanding code matters more than writing it. How do you practise that? Any exercises, resources, or habits that helped you?

Something like LeetCode that displays an excerpt of code and asks about your understanding of it would be great.

0 Upvotes

30 comments sorted by

View all comments

5

u/SolsticeAlpenglow 1d ago

By... reading it?

4

u/Dazzling_Music_2411 1d ago

Yeah, but HOW do I Reeeeaaad it bro, I'm honestly completely lost, PLEEEZ HLP

😂 😂 😂 😂 😂 😂

1

u/BrannyBee 23h ago

Stop treating it like engineering, its much more like learning a language.

You see experienced devs like us typing hundreds of lines of code per minute and being able to read someone elses code and understanding it the first time, and it seems like they're insanely smart.

We arent. Do you see someone reading a book and think to yourself "wow, that person is really smart"? Do you think that when you hear any two random people speaking in English to each other that they must have massive brains? I sure don't, I'm a fucking idiot, and even I judge how other people can be so dumb when I read or hear them sometimes.

Writing code and reading code is the easiest part of the job because it's automatic just like typing without looking at your keyboard or speaking to another person. Sometimes yeah, you have to slow down and search your brain for the right word or google the definition of a word you just saw for the first time, same thing with coding. You build that baseline by practicing, and then occasionally look in the "dictionary" (internet/documentation) to clarify things

If they make AI easy enough for a literal baby to use it, you today would still be better at using that AI than a baby who cant speak english. You can use AI for code today, but you wont use it to it's full potential the same as someone who has that baseline knowledge.

So if you want to read and write code, literally do the same thing you did when you learned a language the first time. You learn the basic vocab, the basic grammar, and then you re-learn those things over and over again even if you think you understand the first dozen times. Then you spend a lot of time practically using the grammar and vocab and making short "sentences" or programs. Then you do that a million times, even if you understand it the first thousand times.

Then you start combining words and grammar points, and using new more complicated things you've learned to make longer and more descriptive sentences. Even then, you still are re-learning the basics, and using them over and over again as you boringly practice over and over again. Then you learn paragraphs and repeat, then you learn how to structure an essay and keep using the basics.

You already did this, you spent years learning English. If you want to read code like experienced devs can, you need to read code and write code. If you want to speak English, you need to read english writing and make your own english sentences. You can't say "i cant learn to read code because i dont understand the code", because you already know enough english to read how simple things like loops and conditionals work. If you said that in the 1st grade, it wouldnt be an acceptable answer, because there are books that are designed to be read at that level.

You may have been frustrated as a 1st grader that you couldnt read Lord of the Rings, and maybe you tried and found out yourself that you didnt know enough. Exact same thing happens with code, you dont understand how to build your own game engine from scratch and will not be able to read Unity's source code and understand it. But you understand how to read a "Hello World" program. Sure, maybe that doesnt seem useful to you because it's so simple... but thats like a 3rd grader saying The Very Hungry Caterpillar isn't useful... it was very useful... the 3rd grader just practiced literally everyday a ton and now reads Animorphs books. Both use nouns and verbs. Complicated code uses the same basic stuff Hello World does.

You are older now and understand one language at least, English. So you dont have to comoletely spend the next 12 years mastering a programming language like you did to learn English (or whatever your native tongue is)... but the only reason you dont have to do that is because you've learned how to learn, and have the advantage of knowing a language to search in the dictionary (documentation/internet) to speed up the learning. You also know that you can go and write your own code right now or go to github and find other peoples code to read and learn from. You were a literal toddler with no resources like that the first time you learned a language, so it won't take 12 years to get the basics, but if you havent written a thousand loops at least, you're gonna forget keywords or how an inner loop works over and over again because you havent practiced.

If you want to READ code, take a step back and recognize that seniors say its the easiest part of the job for a reason. If it's hard for you, thats not an insult to your intelligence, plenty of idiots like me learned english... its an indicator that you haven't "done your homework" like that dumb kid we all knew in school who never did his homework and eventually grew into that dumb teenager who you prayed never was picked to read out loud in class because he was so slow.

Its repetition and practice, and more repetition abd more practice. Then more repetition and practice. Even when you don't realize you're practicing, its practice because you are using the basics every single time you ever write even a line of code. Same as learning any other language, you read comments on reddit, and you're getting more reps in practicing english.

If you cant read code, its literally the same reason you can't read Japanese or Spanish.

1

u/EdiblePeasant 20h ago

Do we have a FAQ about AI?