This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Very General Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Very General Question" Watch "Very General Question" New topic
Author

Very General Question

Faisal Fuad
Ranch Hand

Joined: Jul 05, 2011
Posts: 79

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?

Thank you so much as aslways
Hussein Baghdadi
clojure forum advocate
Bartender

Joined: Nov 08, 2003
Posts: 3476

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 unit testing.
abani patra
Ranch Hand

Joined: Oct 11, 2011
Posts: 70
Hi,
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.
J. Kevin Robbins
Bartender

Joined: Dec 16, 2010
Posts: 851
    
  13

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
Faisal Fuad
Ranch Hand

Joined: Jul 05, 2011
Posts: 79

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.

Always best wishes
J. Kevin Robbins
Bartender

Joined: Dec 16, 2010
Posts: 851
    
  13

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.

Good luck and happy coding!

Faisal Fuad
Ranch Hand

Joined: Jul 05, 2011
Posts: 79

Thank you always...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Very General Question
 
Similar Threads
How long should this take full time?
Print Oracle DBMS_OUTPUT in Java, HOW? Help Please!
Passed SCWCD at the age of 12 years 8 months
class name in choices.txt
Writing the choices.txt