How to understand a code?

Reading other people’s code sucks, especially when it’s uncommented (which is why you should always strive for meaningful comments in your own!). What it comes down to is your understanding of what you’re looking at, and I don’t mean syntax. If you’ve not had any exposure what you’re seeing, be it a framework or certain algorithm, you’ll likely not be able to decipher it. Which is normal, just means you may need a bit more practice wherever you’re trying to operate. Otherwise try googling small snippets of the code. Even if you find a 10 year old, downvoted, unanswered stack overflow question, read and analyze the question they’ve asked and you may be able to pick up on things.

/r/learnjava Thread