So what did I do differently in the two pictures? Change the aperture - that's all (ok, you got me - when I changed the aperture, the camera changed the shutter speed accordingly, to keep the same amount of light coming in to the sensor). The first shot was taken with a very small aperture of f/32 (remember - big number means small hole). This renders a lot of the picture in front of and behind your subject, in focus. The second shot was taken with a wide aperture of f/5.6 - this reduces the front and back focus spread considerably.
Having mentioned macro photography, this introduces the other side of the DOF coin. In this case, you want to increase the DOF as far as you can to get more of that bug into focus. How? Well, the easy part obviously, is to use a very small aperture - as small as you can get. However, since the idea of macro work is to get really close, the other option of distance is out of the question - it's no good having your bug 6 feet away to ensure the whole thing is in focus... Working with a small aperture will mean longer exposure times, and this may lead to needing extra lighting, in the form of flash, studio lights, or a light box/tent, or perhaps a ring flash for macro work (just be careful not to cook your bug) - however, before I get too carried away, lets stop there, and accept that (assuming you have enough light) you can increase your DOF by using a small aperture.
So, in summary...
- DOF (Depth of Focus or Depth of Field) is an indication of how much in front and behind your subject is in focus.
- Use a wide aperture to get a 'shallow' DOF, and isolate your subject against a blurry backdrop.
- The closer you can get to the subject, the greater the isolating effect of DOF is.
- Use small aperture (and possibly more light) to get a deeper DOF, and have more of the foreground/background in focus.