Let’s start with the common definition of what depth of field is to understand how it affects the photos. Depth of Field is the area of a photo in front of and behind the point of focus. Because your lens can only focus on one point, you will get an area that will be in front and behind of your subject. The sharp zone that you capture is known as depth of field. You can either take a photo with shallow or deep depth of field. Shallow DoF will give you a narrow zone that will be sharp and is more focused on the subject. Deep DoF will give you more clear and sharp space to get wider range of the composition.
There are three ways to control your DoF; aperture settings, focal length of the lens and distance from the subject.
Aperture Settings: Large apertures (f/2.4 , f/4) will produce shallow DoF while small apertures (f/16 , f/32) produce deep DoF.
Focal Length: The focal length of the lens we use affects the DoF directly. As the focal length grows, you will have more shallow DoF (300mm lens will give shallower DoF compared to 35mm lens). For example let’s say you have a 18-105mm lens. In 18mm we will have deep DoF, we can see what is in front and behind the subject. In 105mm (without moving our subject) we will get blurry back ground and a shallow DoF which is more focused on our subject.
Distance From Subject: As closer the subject gets to the camera the DoF will get shallower. Moving away from the subject will give you deeper DoF.
There are situations where you can’t use shallow or deep DoF. For example if you are taking a landscape photo you will want to see every detail in the photo. Trying to focus on one subject and blurring the background might ruin the view. As for macro photography the aim is to isolate the subject from the background. It’s very important not to move the camera once you have set everything, because of the shallow DoF any little movement can destroy the scene. I personally prefer shallow DoF because it doesn’t confuse the viewers on what to focus on and most of the photos turn out to be more dramatic.