Make sure that the coffee you are using has a "roasted on" date. All specialty coffee beans will have this as opposed to an "expiry" date.
For espresso, allow coffee to age for 10 - 14 days from the roast date. A "grassy" taste will be present if the coffee is too fresh in espresso.
Coffee is a perishable product and will lose aromatics and flavour over time. Try to buy only enough coffee to last you 6 weeks at most. This will ensure you are tasting the coffee at it's flavour peak and are getting the most out of it.