Sharpness and depth of field (DoF) are two very common elements of photography that help achieve very different outcomes.
Sharpness is pretty much what it says on the tin, it’s how in focus the image is. The majority of SLR lenses tend to be sharper if they are stopped down to around f8 to f11, few are sharp wide open. However, stopping down much further than f11 isn’t really going to improve image sharpness much, and in some cases can even begin to degrade image quality. When talking about sharpness in this instance you’re talking about sharpness at a particular point on the image or put another way, the sharpness at a particular distance in the scene.
Another effect of stopping down/using a narrower aperture is that more of the image comes into focus, this is what is referred to as depth of field. Depth of field can be used to great effect in photography and even in cinematography. There may be times when you want to isolate the subject from distracting background/foreground and this can be achieved by using either a wider aperture or placing some distance between the subject and background/foreground such as in this photo:
Landscapes and architectural photography generally require high DoF, so the priority here is not to concentrate on one point in the scene but to get as much in focus from front to back. The only way this can be achieved is with a narrow aperture, which is why many wide-angle landscape lenses can stop all the way down to f22 and some even further to f36. There is a trade-off here between optimal sharpness at one point in the image and overall focus, and some lenses handle narrow apertures much better than others.
In summary, there are instances where more DoF is required and a small sacrifice has to be made in order to to achieve that, and the amount of sacrifice will be dictated by the lens.