Re:Ask HN: How do you read code?
by nutela on Thursday October 24, 2013 @12:29PM
(#6606169)
Well you should always ask someone who has worked with it but lately I had to come up quickly with a phone formatter class. I didn't have a clue how it worked, no comments. So I start to rewrite some of it, run it see what happens. Then when I learned what the stuff did I renamed it so it made sense to me. Used real long variable names which were meaningfull not just tmp and temp. Can really recommend it and it was very fast.
[ Parent
| on HN ]
Thanks for your answer! Your approach sounds like it works well if you have to write a new component from scratch. What if you had to jump into an existing codebase? How would you go about understanding the code?