Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do you read code?

 
Claude Cundiff
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ranchers!

In doing some of the practice problems for this exam, I'm trying to find a systematic way to read code.

I guess my question is this:
How do you read code? Do you just haphazardly do it or is there a specific way that you approach it?

I thought about UML but I don't think it's very practical for the exam. Not to mention, that has it's own learning curve too.

Hope this makes sense.

Thanks!
 
Harshit Rastogi
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My experience says see the structure of class first. like what constructors what methods a class has. just look at them .
then follow the path through from the main method, because from here the execution starts . So follow it up from here
 
Claude Cundiff
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Harshit,

That actually does help. With that in mind, I'm working on a checklist of things to check and in what order.
 
Saurabh Patil
Ranch Hand
Posts: 48
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Getting the inheritance hierarchy right - that is who inherits from whom is important... also to check whether it is legal. What I find the most tricky is to select between the answer - compile time error or runtime error!
you need to study the code and the flow of the program closely, one thing should be taken care that the program may be incorrect at more than one place but what is encountered first in the flow should be your answer.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic