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 labelied 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
Optional Replicator mirror
Your face IP:[220.127.116.11]
You are visitor number|