This week's book giveaway is in the Java in General forum.
We're giving away four copies of Event Streams in Action and have Alexander Dean & Valentin Crettaz on-line!
See this thread for details.
Win a copy of Event Streams in Action this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

How to study code?

 
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
 
ranger
Posts: 17344
11
Mac IntelliJ IDE 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
 
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.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!