A short depth of field can be very useful when you want to isolate your object from the background, such as when taking portraits or macro photography. A large depth of field is great when you photograph landscapes and overall when you want every detail to be in focus.
Control the Depth of Field
There are three variables that affect DOF, the size of the Aperture, the distance to the object and what lens you’re using. (There is a fourth thing that affects the DOF, but that’s the size of the sensor and unless you have two cameras with different sensor sizes this isn’t something to take into account.)

As you can see in the illustration above, a lower f-number equals a shorter depth of field. A higher f-number will give you focus over a longer distance — when you’re having a hard time getting the correct focus it might be a good idea to extend your DOF by changing the aperture.

The distance between you and the object is also important, the closer you are to the object the shorter the DOF. If you’re photographing a person but needs to have a high f-number you can still get a very short DOF by keeping the distance between you and the person to a minimum.

The last thing you can do to affect your DOF is to change the lens. A wide-angle lens has a much greater DOF than a telephoto lens; the most extreme wide-angle and fish-eye lenses don’t even have to focus because they are so sharp on every aperture for the entire DOF (making for excellent scenic shots).
It’s important to know that the depth of field is greater behind the object than in front of it. If you want to photograph, let’s say 20 kids standing in a line, and you want as many of them as possible to be in focus, but you’re unable to have a small aperture, you should focus on the 6th-7th kid in line, which would balance the field of focus about right (depending on your distance to the kids). If you would focus on the 10th kid, that is the one in the middle, the first few kids would be more out of focus than the kids at the back of the line.
Unlike some other parts of photography, the depth of field works in your favor almost every time. If you want to photograph landscapes you usually have a wide-angle lens — the object is far away and you use a high f-number — all these things together gives you a depth to infinity. And if you’re photographing macro you’re close to the object, you have a telephoto lens and often a low f-number — all these things will give you a very short depth which will make your object stand out and make the background soft and non-distracting.
A typical example of a photo with shallow depth of field control. (Only the main subject of interest is enhanced by throwing other elements out of focus.)

A typical example of a photo with extended depth of field control (From near to far in sharp focus).

Quick Reference Guide: Depth of field is governed by three factors: aperture, lens focal length and shooting distance. Remember the following relationships:
1. The smaller the aperture, the deeper the depth of field (the other two factors remaining the same). For example, if the lens focal length and the shooting distance stay the same, the depth of field is much deeper at f/16 than at f/1.4.
2. The shorter the lens focal length, the deeper the depth of field (the other two factors remaining the same). For example, comparing a 28mm lens with a 50mm lens at the same aperture and shooting distance, depth of field is deeper with the 28mm lens..
3. The greater the shooting distance, the deeper the depth of field. i.e. other two factors remaining the same). For example, if the subject is photographed from three and then from seven meters away, the zone of sharpness in the foreground and background is greater at seven meters.
Another characteristic of depth of field is that it is generally deeper in the background than in the foreground.
Sources:
http://www.mir.com.my/rb/photography/fo ... depth.html
http://www.tutorial9.net/tutorials/phot ... otography/