Sometimes a developer sits and thinks because they feel unsure about themselves or their decisions. The solution to this is similar to the solution in the "Understanding" section – whatever you are uncertain about, learn more about it until you become certain enough to write code.
If you just feel generally uncertain as a programmer, it might be that there are many things to learn more about, such as the study fundamentals that I listed in Chapter 36, Why Programmers Suck. Go through each piece you need to study until you really understand it, then move on to the next piece, and so on.
There will always be learning involved in the process of programming, but as you know more and more about it, you will become faster and faster and have to think less and less.