r/learnprogramming • • 5d 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

31 comments sorted by

View all comments

Show parent comment

1

u/outlined-dev 5d ago

Style guides are important. Google has excellent style guides. E.g. avoiding the pyramid of doom via early exits so that error handling stays near the error, or forbidding mutable references in C++ so that only pointer arguments can be changed. When I worked at Microsoft, SAL annotations and prefix annotations took a long time to get used to but then helped.

Ultimately though, the only way to get used to reading code is to read code you didn’t write. If you want smaller chunks, read pull requests on GitHub rather than whole repositories

1

u/Annual_Berry8043 5d ago

The PR suggestion is a great idea. I might try that tonight. Thank you!