aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes How do you read code? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "How do you read code? " Watch "How do you read code? " New topic
Author

How do you read code?

Claude Cundiff
Ranch Hand

Joined: Mar 20, 2008
Posts: 78
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

Joined: Apr 15, 2008
Posts: 131
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


<a href="http://technologiquepanorama.wordpress.com" target="_blank" rel="nofollow">My Techie Blog</a><br /><a href="http://www.java-questions.com" target="_blank" rel="nofollow">Java Questions</a>
Claude Cundiff
Ranch Hand

Joined: Mar 20, 2008
Posts: 78
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

Joined: Dec 11, 2005
Posts: 45

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.


All for one and one for all!
 
Don't get me started about those stupid light bulbs.
 
subject: How do you read code?