The technical bits of photography can be a bit tricky. Understanding the effects of different aperture settings comes with lots of experimenting. For example, focusing at infinity sounds fairly straight forward. Essentially everything in the background will be in focus. But depending on the aperture you have set, the items in the foreground may be out of focus. Luckily Robert Seber has posted this helpful chart to his Flickr photostream showing the minimum distance you need to be to get everything sharp and in focus.
To quote Robert on how to read this chart:
Suppose you are using a 20mm lens focused at infinity. Something in the foreground is 12ft away. The point at which 12ft and 20mm intersect is closest to the f/13 line, so f/13 is the aperture to use.
Suppose you are using a 50mm lens focused at infinity. Something in the foreground is 6ft away. No line on the graph is close to this. At this point you need to re-think your shot and move further from the foreground, otherwise it will be intolerably soft. 26ft to the foreground will allow you to use an aperture of f/22.
Suppose you are using a 10mm lens focused at infinity. Something in the foreground is 12ft away. You’re above the f/8 line so f/8 will work just fine.
The basic rule to take away from this is the longer the focal length you use the smaller the aperture you will need to use to get the foreground sharp, or the further you need to move back.
You should also check out Robert’s photos. His macros are really top notch.