Hi everyone...I am very new in this JSP, Servlet world and improving everyday with all of yours help and following all of yours suggestions. But still I get nervous when getting huge Java/Web Project from my boss and ask me to fix some define bugs. Every time I feel like I am lost while understanding the whole project...how that was written, how the files (formbeans, concrete java class, interfaces) are connected to each other, what the DAO files are doing....why do we need UserVO...bla..bla. At this stage I am taking long time just to familiarize myself with the project environment rather than finding the problem right away and write my code for it's solution....and as you know, waiting for long is not accepted in Corp. world-right?
I know some of you will laugh by seeing my poor situation....and may be this is the common scenario while learning for the first time....but believe me or not your suggestion is important. Is there any best practice or way some of you guys follow to deal with a huge Java Project? Is there any IDE tricks so that easily you can see the clear picture about a that project? Yah...always documentations does help...but what if you are unlucky and couldn't manage any proper documentations for a project which you have to deal with?
No one is going to laugh at you. JavaRanch is the friendly place for coders.
It is obvious that your project uses a lot of design patterns (DAO and Value Objects for example).
First you need to familiarize yourself with the design patterns being used in your project, you can ask the senior programmers in your team.
You don't to understand every piece of code in your project at this level, just make sure you understand the code needed to be modified in order to fix the bug.
It is definitely better if your project has the luxury of unittesting.
I ll suggest you should try to know the common flow of your application then if you can get class diagram and sequence diagram check that too.
After that you can feel bit familiarize with that environment.
As a relatively new developer I feel your pain. Learning the flow of an unfamiliar, poorly documented application is like following a trail of breadcrumbs through a dark forest.
The above suggestions are very good, but I'd like to add a couple of more things that have helped me as I've fought the same battle.
First, learn to read a stacktrace. This will lead you to the class that is throwing the error if the bug you are hunting is actually throwing an exception. Always look for the first exception thrown; any following exceptions could just be a result of the first one and can quickly lead you astray.
Second, learn to use Firebug. It's a web developers best friend.
Third, setup a local server on your desktop so you can run the application locally and set breakpoints to help you step through the code, checking values as you go.
Finally, don't be shy about using System.out.println or log to send messages to the console or log file. I often do things like this:
Doing something like this can often be faster than stepping through method after method. You can quickly scan the console or log and often spot the problem. Tip: leave the output messages in there, just comment them out when you are done. You'll likely need them again at some point in the future.
"The good news about computers is that they do what you tell them to do. The bad news is that they do what you tell them to do." -- Ted Nelson
Thank you all very very much. Specially JK, i already wrote down your suggestions and will for sure follow from now on. About the first point where you did mention "Stacktrace", by that are you referring to the Console? I am using IBM RAD and since the begining....yah, i am monitoring the console very closely when problem arises.
On the other hand, few days ago one of my colleagues showed me the "Call Hierarchy" option from RAD. Really that was also very life saving
Again guys.....because of you all, to me and I believe to others, this is the best forum even....I am not worried any more while you all are here...let's do some serious Java from now on.
Stacktrace is sent to the console and the error log. On Tomcat it will be in catalina.out. It's the error message that you get when your code throws an exception and your catch block does an ex.printStackTrace(). My catch blocks often look like this:
That allows me to quickly see where the error came from, and then I can go back to that method and use breakpoints to track down the offending code.
Now purists will tell you that you should be using log4j instead of System.out.println, but this is adequate for now. You can learn logging later on; get the fundamentals down first.