Buying coffees as whole beans and grinding them just before brewing is by far the best alternative for espresso drinkers who are serious about quality. Buying whole-bean coffees and having them ground at the store is probably second-best.
Whole-bean coffees offer almost infinitely more choice for espresso brewing, and produce (in most cases) a fresher, richer, more fragrant beverage.
Whole-bean coffees are sold in two forms: fresh in bulk from bins and in foil valve bags. The valve bags are designed to protect the coffee from both moisture and oxygen, the two sources of staling in coffee. The oxygen is usually flushed from the bags by using an inert gas like nitrogen before the freshly roasted coffee is dropped into the bag and the bag sealed. Freshly roasted coffee produces carbon dioxide, which is trapped inside the bag, further protecting the coffee from oxygen. The valve imbedded in the bag allows excess carbon dioxide to escape and prevents the bag from inflating.
Furthermore, simply because a coffee is sold in bulk from a bin doesn’t mean it’s freshly roasted. Starbucks, for example, packages its bulk coffees in valve bags. Clerks simply open the bags and dump the coffee into the bins.
Ultimately, whether the coffee appears in bags or bins, it comes down to trusting your taste buds and trusting the store. Specialized coffee stores with high volumes are almost always more reliable sources than supermarkets. Stores with high volumes are typically more trustworthy than new stores with low volumes. Stores that roast on premises can be the best place of all to buy whole-bean coffees, assuming the roasting is done right. Locations of specialty coffee stores can usually be found in telephone classified pages under the retail coffee heading.