Welcome to the Ranch.
I'm not sure there is some "right way" of reading code, I guess that a lot depends on the situation and the person who looks at the code.
ImDinesh Sharma wrote:Where to start, what needs to be noticed, although i know that it depends on the code but i m looking for a general thought process that should occur when looking at it and try to get it.
In my opinion, first you need to know what are you looking at, meaning you need to understand what the problem was and what was meant to be solved with the specific part of the code, so you could compare whether problem's description and its expected solution is reflected in the code part. That's one.
Two.
TDD mindset people I think tend to start looking at tests, so the problem description and meant solution of it is also reflected and covered in the
test suite. Now, that's barely the case in practice, unfortunately though.
ImDinesh Sharma wrote:Regardless of how big the code i am seeing to understand, i wanna get it in my brain the right way so that i do not mess up with my head.
Three. I think that is the exact symptom if the code weren't readable, so you get headache. The code you are looking at at the very moment supposed to be a fairly small part which clearly tells what it does, meaning some higher level concepts communicated, then presumably some method calls which accomplish some sort of smaller tasks of a bigger whole.