Timing is very important. And let me emphasize that you are not praising your dog for stopping a behavior, but for behaving correctly. This means that you should be praising your dog through normal daily routines as your dog is looking at you, following you, lying quietly, etc. This means that you praise your dog during the good behavior. Timing is just as important in punishment as it is in rewards.
Many people have poor timing when they first begin to teach dogs.
But if you reward at the wrong time, your dog will still want to work for you. If you punish at the wrong time it is quite detrimental to your relationship with your dog. Either way, poor timing is your mistake, not your dogs. You will find that for every problem behavior you can create a solution that requires patience, commitment, and respect for the dog. It won't be long until you discover that it is the answer to possibly all of the dog problems that you encounter.