How sharp an image appears depends on many things. The resolution of the eye is not the only factor. Our ability to distinguish between two points being separate depends on the distance to the object, our age and general visual acuity, and many other factors. In photography the depth of field or area of acceptable focus is a matter of focal length, aperture, the method of reproduction and the viewing distance. Billboards look perfectly sharp to us, but their resolution is actually very coarse, as little as 12 ppi. The closer we are to a print, the greater the required resolution the printing must be to prevent us from discerning the individual pixels or seeing the image as out of focus. Many photographers view a print from a very short distance to "see if it is sharp" which is not a good measure. The bigger the print the greater the "viewing distance" should be. If you cannot see the whole image comfortably you are too close to judge the resolution.
An architectural client of mine asked me to make huge prints to display at his office. When I discovered that the display location would be a series of hallways I had to talk him down in print size realizing that you simply could not get far enough away to view a huge print. In the reception area a much larger print was more appropriate as the viewer would be at least six feet from the print rather than maybe three feet in the halls. You should take similar considerations when hanging prints in your house, or buying a large flat screen tv. Too big is not good. In the case of tvs, too small isn't either.
Depth of Field, or the apparent increase in sharpness before and after the primary subject comes from the reduction in the size of the out of focus points of the image. These are called "circles of confusion". They can be easily seen when points of light are rendered out of focus and appear as discs instead. What is not apparent to you is that every point in the image is rendered in the same manner. The overlapping out of focus areas of the image blend into each other and create the effect you see. The overall quality of the out of focus image, especially in highlights, is what is referred to as bokeh and is a function of lens quality.
We generally refer to depth of field as the area of acceptably sharp focus foreground to background. In front of and behind this area you see increasingly less sharp rendering of the scene. The objects in the image are not well defined and eventually the area simply is a soft blur. Control over the area of sharp focus and the areas of less well defined subject matter is a part of the creative process. In a portrait for example the photographer may choose to blur the background completely, or render it recognizable but not completely sharp depending on the purpose of the image. Shallow depth of field limits the sharp area to concentrate the viewer's attention on the important subject. In landscapes and architectural images it may be preferable to have the entire image appear sharp.
Have you wondered why your point and shoot camera won't close down beyond f/8 or even f/5.6 in many cases? First, the small sensor means that depth of field is pretty incredible even at fairly wide apertures. Second, and even more important, is that physically smaller apertures actually degrade the image quality. Light passing through smaller apertures is diffracted producing larger Airy discs which may overlap the grid array resulting in less sharpness. The Airy disc is named after Sir George Airy who discovered the phenomenon in which smaller apertures produce less well defined images with rings of diffused or diffracted light around them. As these overlap the capture array in a digital camera they can degrade the resulting image and limit the effective resolution.
If you came to digital photography from film you may be accustomed to using smaller apertures to gain depth of field. The increased foreground to background apparent sharpness was the result of reducing the circles of confusion created by the lens onto the film at smaller apertures. This creates the illusion of greater sharpness throughout the image. With film the random dispersion of grains in the emulsion made this a valuable technique. Digital capture is a different thing altogether. The array of sensors on the chip in your camera are not randomly dispersed like film grain was, and do not vary in size. Reductions in aperture result in smaller circles of confusion as they did in film, and depth of field increases in a similar manner.
But, there is a secondary consideration that was not a big factor in film capture. Parallel rays of light passing through the aperture start to diverge at some point creating what is known as an Airy disc, essentially a pattern of diffused rings beyond the desired circle of confusion. This is true of any optical system such as a microscope, telescope, or our cameras. When these discs overlap into an adjacent sensor in the camera the result is a degradation of the resolution. This actually happens gradually, but there are some mathematical determinations that are used to determine the point at which the image ceases to gain in sharpness, and actually begins to soften as a result of the overlap. This is called diffraction. The diffraction limit is the point at which the diffraction degrades an image to an unacceptable degree. Depending on several factors including the size of the intended output, that point can be reached at different apertures.
In a practical sense this means that there are apertures beyond which the gain in apparent depth of field can be downgraded by the diffraction resulting in a less sharp overall image. In plain words, too small an aperture means a fuzzy photograph. Naturally, this does not occur instantly, but increases gradually as the aperture gets smaller, and the output gets large enough for us to perceive the loss of resolution.
Depth of field is something we pay attention to with the idea usually being that more is better. In the case of digital capture, sufficient is a better aim point, and not going beyond what is needed should be avoided, especially if it puts us into the realm of diffraction limitation. In most cases, for most subjects, that means an aperture wider than we might have chosen in shooting film. Depth of field should be sufficient to render the primary subject perceptively sharp. In a scenic the required depth of field would be more than with a portrait where isolating the subject with a shallower depth of field may be desired.
Optimum aperture is mathematical and takes into consideration a number of factors. The pixel density of the sensor; the pixel size is used to determine the point at which the lens will start to create an Airy disc that will degrade the image quality. Simply, the smaller the pixels the greater the opportunity for diffraction. Higher resolution cameras actually make the problem worse. There is a practical balance. Fortunately, we don't have to do the math. There are people much better at it than most of us, and we are more interested in making photographs.
To avoid too much in the way of explanation I will direct you to a wonderful web site with all the information you need to determine the best shooting practices for your camera. The Diffraction Limit Calculator on the Cambridge in Colour website allows you to enter your camera type and a selected aperture and calculate the result. If the result says "yes" you need to choose a wider aperture to avoid image degradation due to diffraction. I strongly recommend clicking on the "show advanced" option in the upper right in order get more refined results.
As an example, using an APS-C camera with an aperture of f/11 may be OK, but at f/16 you are in trouble. Intermediate apertures are not available on the calculator, but based on the Airy disc size you can pretty much determine the limit to your choices. My caveat to this is that you should run some tests of your own to determine practical limits if you are a serious photographer of landscapes. Most of my landscape photographs are shot at about f/8. The further from the camera the subject matter is, the wider the practical aperture. The proximity of the closest subject matter and the desired sharpness of near to far objects influences your choice.
Also under the Tools tab on the website is a Depth of Field Calculator. This is something I suggest you spend some time with as you will likely find it somewhat surprising how your chosen point of focus coupled with the selected aperture result in depth of field. At f/8 with an APS-C body and a 24mm lens, if you are focused at 25 feet (just about the hyperfocal distance) your depth of field extends to infinity, and it extends toward the camera to under five feet. That is considerable depth of field, and the non diffraction limited aperture means maximum image sharpness even on a print up to 20 inches viewed at a distance of one meter, which is reasonable.
If you experiment a bit with the calculator you will also come to see that increases in depth of field closing down from f/8 to f/11, for example, are not as great as you might suspect. Choosing an appropriate point of primary focus is often a more important consideration. As much as in a portrait photograph, the point of focus for the "primary subject" in the image is most important. For interior architectural photography I have found that asking yourself a simple question leads you to the best decision - where will people look in the photograph? That area should be the most sharp and secondary areas can be less than perfect.
Gaining an appreciation for the necessary aperture for a given scene may cause you to rethink a number of things about how you approach making a photograph, including where you focus as well as your choice of aperture. While it is not practical to carry a computer with you into the field to calculate every situation, I have found that having a reference to typical situations either in your head or on a note card in your camera bag can help you get better photographs.