Focal length, aperture, angle at which you choose to position your camera relative to your subject also greatly affects composition. For example, choosing a wider aperture will blur the background and foreground, effectively lessening the importance of objects placed in there. It will also more often than not result in more noticeable corner shading (vignetting), which will help keep viewer’s eye inside the frame for longer. On the other hand, closing down the aperture will bring more objects into focus which, in turn, may result in better image balance. How so? Well, “sharper”, more in-focus objects may attract more attention than a blurry shape, but not always (see image sample below). An experienced photographer will use all the available means to achieve the desired result. It is worth noting that de-focusing objects in the foreground or background does not negate their contribution to overall composition of the image. Simple shapes, tones, shadows, highlights, colors are all strong elements of composition.
Take a look at the below image. Despite the fact that part of a wall showing in the foreground is completely out of focus, it is the most vivid part of the photograph as well as being quite bright. For this reason, it attracts our attention much more than the main subject (man with the tea cup and his Siberian Husky hiding in shadows). The bright yellow rectangle is the first thing you see when you glance at the photograph. A good and obvious way to fix this would be to reduce the vividness and luminance of yellow using Lightroom’s HSL panel (although I actually like the contrast between the two parts of the photograph):