The goal is to score runs, you score runs by getting on base. The order of the best ways to get on base are HR, Triple, Double, Single, Walk. The walk may be last on the list, but it doesn't mean it's not useful. However, you always take a hit or extra-base hit over a walk. That doesn't mean you should swing at balls, if the pitcher throws 4 balls, you take the walk. If he gives you good pitches to hit, you swing hard and try to get an extra-base hit. It's all in the context.