If you want to find the optimal aperture for a particular lens, it's usually best to test that lens, since as Ed says, design characteristics vary and there is no universal rule.
There are certain lenses that I have that I try to use at certain apertures, because I know they have a nice look at one aperture or another (e.g., the Voigtlander 50/2.0 is beautiful at f:8, and Heliars look most like Heliars at wider apertures, and the Color-Skopar on my Voigtlander Perkeo II likes to be at f:11-16 or the corners will be unsharp), but in general, if you need the DOF, it is better to stop down as much as you need to get the DOF you want and not worry about diffraction. If you are using relatively modern lenses, they are usually designed not to stop down past the point where diffraction is a significant worry.
Inadequate DOF is always a bigger visual distraction, in my opinion, than the general softness that may result from diffraction. If you are getting noticable diffraction at small apertures, then the solution is often just not to print as big. If you shoot large format and contact print, you can pretty much ignore diffraction effects if you don't go past, say, f:256.