The dictionary says that, in photography, depth of field is the distance between the nearest and the furthest objects giving a focused image. In other words, depth of field is how much of your picture is in focus. If you have only the objects in the foreground in focus and everything else is blurred, you have a shallow depth of field. If both foreground and background are in focus, you have a deep depth of field.
How to use DOF
Depth of field dictates where you want the viewer to look. For example, if you want to highlight a certain subject in a crowded picture, you should use a shallow depth of field and leave only the subject of interest in focus. Blurring the background will eliminate other subjects that might attract the eye. But if you do landscape photography and you want the viewer to equally look at the entire image, you should use a deep depth of field and put everything in focus.
Usually, a picture with an unique subject will be better if you use a shallow depth of field. A picture with a multiple subject will be better if you use a deeper depth of field. It also depends of how far are you from your subject and if the subject is moving or not.
How to achieve DOF
There are three factors that influence the depth of field. First is, of course, how close you are to the subject. If you get closer to the subject, you will achieve a shallower depth of field. If you move away from the subject, you will achieve a deeper depth of field.
The second factor you should have in mind is aperture. Aperture controls how much the diaphragm of the lens opens and how much light gets in. A small aperture will give you a deeper depth of field, while a large aperture will give you a shallower depth of field. Keep in mind that f-stops values are inverted (a small number corresponds to a large aperture, f/2.8 for example, and a large number corresponds to a small aperture, f/22 for example).
The third factor that contributes to achieving a certain depth of field is the focal length of your lens. Focal length is a property of the lens and reflects its capacity to magnify an image. It also determines the angle of view. Related to depth of field, focal length replaces the movement of the photographer in relation with the subject. This means that using a bigger focal length you will magnify the image and the effect will be similar to getting closer to your subject: a shallower depth of field. On the contrary, using a small focal length will zoom out the image and the effect will be similar to getting away from the subject: a deeper depth of field.
DOF is Important
Depth of field is very useful in photography. It allows you to choose how much if the image you want to show off, which are the most important elements, and where should the viewer look first. Depth of field is extremely important for composition. It also makes you search for the best option, it makes you move around, learn some optics and some geometry, and most of all it makes you explore the world through the viewfinder.