• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to study code?  RSS feed

 
Ratan Kumar
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Its a very basic question. I have a moderate size j2ee web application with components as JSPs,servlets and java logic.I have no documentation for that and no help.Kindly let me know is there any systematic way to study the code.My intention is to understand the program flow from jsp to servlet, between classes and methods and to understand the functionalities of the methods.

Can anyone help me with this?

Thanks in Advance
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I find definitely looking at the code and trying to figure some things out.

But I really find remote debugging, where you connect to the server through your IDE and stepping through the code works the best for me. You get to see variables values et al.

Mark
 
Ratan Kumar
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Thanks for the reply.

I have the application setup on my machine in wsad.I am aware of the debugging option, but how I decide where to put the break points?

One option is i am trying to put system prints in the classes so that i can roughly figure out the flow.

Any help/suggestion would be welcome
 
M Easter
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One approach might be:

1. Find a breakpoint close to where something tangible happens. For example, if you change a field in the UI, and can find where that value is saved, that's useful IMHO. Because you have a place of "cause and effect", which is a useful "foothold".

2. With the above breakpoint, you can do 2 things: (a) look at the stacktrace, and get a feel for the calling hierarchy (b) look at the local variables and their members. From this, you can start to branch out. I would pay close attention to abstract base classes because they may be key parts of the architecture.

Another idea is to use the Javadoc and/or a tool like Doxygen to try and see what is going on from static analysis. Here, you want to start to see relationships among the classes. IMHO, this is not as useful as debugging though.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!