The first key is to referee the defense. Most (or all) spectators are watching the offense so what they think is a stationary defender may not be. He has to first establish a legal guarding position (both feet on the floor w/in 6 feet). If he is switching onto a driving offensive player, the requirement is much tougher (establish) than if he has been defending that player before the drive (maintain).
If the defender has established a legal guarding position, he is entitled to that position and everything above that position, and may move to maintain that position. He is not entitled to 2 ft. in front of him where his arms are extended (even if his feet don't move). Neither is he entitled to bring one arm down across the shooter's arm and bring it back up.
Now, if the defender has a legal position, contact becomes the responsibility of the offensive player. It can either be a charge (if the defender is put at a disadvantage) or nothing (if he is not).
Hope this helps a little, I'm sure that others will jump on it if there's a mistake
Blackhawk