This article is from the Coffee and Caffeine FAQ, by Alex Lopez-Ortiz with numerous contributions by others.
The quality of a brew depend on the following factors (in no
particular order):
1. Time since grinding the beans.
2. Time since roasting.
3. Cleanliness with brewing equipment.
4. Bean quality (what crop etc).
5. Water quality.
Fact: Unless you are buying some major debris, bean quality is not
very important, as compared to 1-3 and 5.
Fact: A coffee can in the supermarket often contains major debris, so
be careful when you choose. (See note below).
Fact: Once you have freshly roasted and ground coffee, filtered water
and equipment free of oil residues from the last brew, quality of
beans makes a huge difference.
NOTE: A coffee can in the supermarket often contains a blend of
Arabica and robusta beans while most coffee houses sell only arabica
beans. Arabica beans are usually flavour rich, while robusta beans
have more caffeine, less flavour and are cheaper to produce.
When you buy coffee, whether in a coffee house or in a supermarket,
you want to get 100% arabica, except for espresso blends, which are a
combination of both.
For freshness, in a coffee house it is better to buy popular blends
that move fast, while in a supermarket vacuum packaged containers with
expiry date are your best bet.
 
Continue to: