tackling : Java Glossary
home T words local find no local find frame, full screen Google search web for topic jump to footer translate with Babelfish by Roedy Green ©1996-2008 Canadian Mind Products
Go to : punctuation 0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z (all)
tackling
Schools teach by giving tidy, tiny, clean problems. In the real world, nobody wants such problems solved. There are already canned solutions for them. The real world wants only ugly, big, ill-defined problems solved. How do you tackle a problem that is too tough for you? The prime thing to keep in mind is that in future, you will be smarter, so not to worry that you can’t solve the whole problem now. Not to worry that you haven’t the vaguest clue how you will solve it. Just solve the easiest piece of it that you can. If you can’t even solve a piece of the problem, see if you can construct a tool, piece of code, method or class that you think might conceivably be useful in solving the problem. Even if the tool turns out not to be directly useful, in the process of constructing it, you will become smarter. Then you iterate, trying repeatedly to pull off even a tiny tractable piece of the remaining problem that you can solve. Every time you do this several nice things happen:
  1. The remaining problem is smaller.
  2. Your subconscious mind has had longer to chew on the tough parts.
  3. Your mind is cleared of the clutter of worrying about the part you have solved. It does not jitter. It can focus more on the crucial remaining part.
  4. You have created tools not only to solve the problem, but to think about the problem in a clearer and more abstract way. With details already handled you can see the forest for the trees.
  5. You are more familiar generally with the problem and any relevant documentation.
Another approach if you can’t solve a problem, is to think of a much simpler related problem that you could solve. Once you have solved that easier problem, see if you can come up with a problem intermediate in difficulty between what you have just solved, and the one you really want to solve. Solve that. Then tackle the real problem. Take as many baby steps toward your actual solution as you need.

After you have stripped the problem bare of every conceivable fancy feature, next divorce yourself from any concern that anything could go wrong. Assume you have perfect data. Assume that when you look something up in a table it will be there. Assume your references will never be null. Assume your casts will never fail. See if you can then write the code. You can then focus 100% on the normal case.

While you are doing this, scores of what-if-x-happens? thoughts may crowd your brain making it impossible to focus on the normal case. Just create a comment section labelled worries, and jot your concerns there. Later, go back and review that list. Often your code will handle those pathological conditions in the wash. Others you will have to add code to deal with. As you cover each concern, delete it from the list. The key is not to overwhelm your brain with too much detail.

By focussing on the normal case first, your code will tend to be better structured, to emphasise the usual case rather than the pathological. Someone reading your code usually first wants to understand the most common cases. I have an idea for SCIDs to make that emphasis on the usual cases even easier.


CMP_homejump to top
CMP logo
feedback Please email your feedback for publication, errors, omissions, broken/redirected link reports
and suggestions to improve this page to Roedy Green : feedback email
made with CSS
HTML Checked!
ICRA ratings logo
mindprod.com IP:[65.110.21.43]
Your face IP:[38.103.63.17] The information on this page is for non-military use only.
You are visitor number 7,052. Military use includes use by defence contractors.
You can get a fresh copy of this page from: or possibly from your local J: drive (Java virtual drive/Mindprod website mirror)
http://mindprod.com/jgloss/tackling.html J:\mindprod\jgloss\tackling.html