tackling : Java Glossary


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 labeled 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 focusing 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.

When you were a child, someone probably gave you a book of puzzles, perhaps crossword puzzles. When you were working on the first one, did you say to yourself Woe is me! There are 50 more puzzles to solve after this one. No, you said, Lucky me. I get to solve 50 more puzzles after I finish this one. You did not fret about the upcoming puzzles. You just enjoyed the one you were working on. Use a similar attitude to coding. When you find yourself yak shaving, discovering more and more subpuzzles that need to be solved before you can complete your task, just jot them down and forget about them. Work on only one problem at a time. If you try to think about them all at once, you will become quickly overwhelmed and will just sit there like deer in the headlights. If the current problem is overwhelming you, try to partition it into some simpler problems and work on those one at a time, easiest first.

This page is posted
on the web at:


Optional Replicator mirror
of mindprod.com
on local hard disk J:

Canadian Mind Products
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.

Your face IP:[]
You are visitor number