permaculture playing cards
The moose likes Meaningless Drivel and the fly likes How to become an expert in troubleshooting Java errors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Other » Meaningless Drivel
Bookmark "How to become an expert in troubleshooting Java errors" Watch "How to become an expert in troubleshooting Java errors" New topic

How to become an expert in troubleshooting Java errors

justin smythhe
Ranch Hand

Joined: Jul 06, 2012
Posts: 107
I had the opportunity to see to Java developers at work. They had about 2 years experience.
I saw that they could troubleshoot many errors with ease. How can I become half as good as them?
Please do not say that it will come with experience. I know that part already. But is there a way to learn
troubleshooting, besides by experience ? I feel so frustrated when my work is stopped for 2-3 days due
to some common error which my experienced buddies solve in 10 minutes.

Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

Yes, it's the experience. But you want a quick tip? Okay, here it is:

Read the error messages and believe what they say.

I find it amazing, the number of people who post their problems on internet forums with error messages which describe the problem exactly, and then ask what their problem is. Half of the battle in fixing bugs is understanding what you're looking at.
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33118

You can gain experience faster by recognizing patterns. When you see an error, write it down. That way you remember it the next time you see it. Also fiddle with something that works. Create an error, read the message and remember it. This is easier when you know the problem.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Martin Vajsar

Joined: Aug 22, 2010
Posts: 3733

  • RubberDucking does wonders. (I don't have a rubber duck on my desk, so I use my colleagues instead. )
  • Learn to create Short, Self Contained, Correct Examples. This is actually very similar concept. Very, very, very useful.
  • Remember the golden rule of debugging: if the problem does not make sense, it's two (or more) bugs combined.

  • I also like the "write it down" part of Jeanne's advice. More than once I was bugged by a persistent problem which I was not able to solve easily, but when I found the solution I didn't note it down. Sometime later I've bumped into it again. Aaaaaaargh!
    Randall Twede
    Ranch Hand

    Joined: Oct 21, 2000
    Posts: 4351

    no advice, just a ray of hope. after a while some will become so easy you won't believe it.
    symbol not misspelled it or didn't import it
    array index out of bounds... usually off by one

    Visit my download page
    Paul Clapham

    Joined: Oct 14, 2005
    Posts: 19973

    Another technique that I found useful in the past was to try explaining my problem to my boss. It didn't matter that my boss had no idea what I was talking about and indeed wasn't even competent to read the code, what eventually happened was something like this:

    Me: And then it does <whatever> and... Oh. Now I see what was wrong.

    This worked even better when the boss would play along and ask stupid uninformed questions, because often one of them would undermine an assumption I had been making all along.
    Randall Twede
    Ranch Hand

    Joined: Oct 21, 2000
    Posts: 4351

    excellent Paul. my best friend knows nothing about computers at all but still lets me bounce my thoughts off him. a true friend
    Jesus Angeles
    Ranch Hand

    Joined: Feb 26, 2005
    Posts: 2068
    Troubleshooting can happen in different phases of your coding.

    If it is a new one, and you dont have logs, add logs. Make your code more testable and modularized (which is what you should do anyway).

    If it is an existing application and it doesnt give proper logs, or for example, the system simply hangs, add more logs. There are some scenarios like in jni where you run out of memory or something, and it just hangs giving no clue at all, but dumps something in your desktop.

    Wasting 2 days on an error happens to everyone. The difference to the experienced one is, if he is already hours or too long into it, he accepts that he needs help. He can dig deeper, ask google, etc.
    chris webster

    Joined: Mar 01, 2009
    Posts: 2289

    Some great advice there from wiser heads than mine - I'm sold on RubberDucking!

    Just one tip from me: take a break and go do/think about something else. It's amazing how often, when you return to your desk after a coffee break or (even better) a relaxing weekend, you can take one look at your code and say straight away "Ah, that's where the problem is!".

    No more Blub for me, thank you, Vicar.
    James Boswell

    Joined: Nov 09, 2011
    Posts: 1051

    Also, don't try to do it all on your own. That is what a development team is all about. If you get truly stuck, explain the problem/exception to a colleague. Chances are, they may have seen the problem before, know of a change to the application that may have introduced the bug or simply shed different light on it.
    I agree. Here's the link:
    subject: How to become an expert in troubleshooting Java errors
    It's not a secret anymore!