Even very experienced baristas often don't take advantage of the opportunities to improve the espresso that are available while making the shot. They lock the portafilter into group, turn on the pump or pull the lever, and pray. If the shot is roughly right, they'll serve it and make small grinder adjustments for the next one—if it's way off, they'll dump it and make larger grinder adjustments. This approach requires that grind settings and machine temperatures and pressures be very close to perfect. However, if you know a few things about how espresso extracts, you can correct somewhat larger deviations from the correct levels of these variables on the fly. Moreover, however correct or incorrect the variables, you can assure that you're getting the best espresso possible under the circumstances.
The first aspect of working the shot is to make sure the extraction is correct by ending the shot at the same color every time. The exact color depends on blend and machine, but it is always a light tan described by experienced baristas as blonde. If the stream is still well filled with crema, it is not yet blonde. If the stream entering the cup discolors the crema into a light tan color, it's gotten lighter than blonde. Typically the right point is around the time when the stream starts changing from foam to liquid.
How and why does this work? Underextracted coffee is sour and thin; overextracted coffee is weak, with bitter and acrid notes. As the ground coffee extracts, the water flowing through it colors less and less. So the color is a measure of the degree of extraction and stopping at the same color means stopping at the same level of extraction. Perfect extraction occurs when 20% of the ground coffee's weight has dissolved into the coffee. Knowing the color that corresponds to this so you can stop the extraction means getting the best espresso for a given pull every time.
The graphic below illustrates the 'extraction space' of espresso, showing shot time and volume, the changes in color, and the effect of grind fineness. It will be used extensively in the diagnostic section, but will also help clarify the concepts discussed here.
Let's suppose the grind is way off and you don't know about this.
Based on what you've read, you are looking for a two ounce double espresso in 27 seconds. If the grind is too coarse, you get the two ounces in about 15 seconds. If you stop there, the cup will taste underextracted. If you go for 27 seconds, you'll get an overflow of overextracted bilge. But if you stop the shot at the right color, you'll have a 20 second, 3 ounce lungo (long shot)—not what you wanted, but quite drinkable. Now suppose your grind is way too fine. If you don't know the rule, you'll have a ½ ounce of intensely sour stuff at 27 seconds, or 2 ounces of intensely bitter stuff after a minute. If you do know the rule, you'll have a 1 ounce ristretto (short shot) after 35 seconds—again, not what you wanted, but enjoyable nevertheless. After you tried the shot, you can correct the grind, or even stay with the "mistake" if you decide you liked it more. In any case, you'll have a range of shot possibilities you can explore.
As can be seen on the extraction chart, it takes a longer time for the flow to go blond on a restricted volume shot than on a long volume shot. This relation between shot blonding and the volume and length of extraction is known among espresso enthusiasts as Al's Rule, named after Al Critzer of Cimballi.
Sometimes it is not the grind, but the temperature, pressure, or even the blend itself that are off. Ideally, you would fix this by correcting the problem directly (see next section), but in many cases it takes more time that you have before rushing off to work, running errands, and so on. Another aspect of the extraction allows for a quicker fix. The early part of the extraction contains a predominance of the acids and the portion derived from fines. The central part of the extraction contains a predominance of the sugars and caramels. The final part of the extraction tends towards bitterness, but will also be fairly weak, sometimes almost tasteless. Among enthusiasts, this is known as the rule of thirds.
So, if the espresso is too sour, or worse, has the citrus peel acridity from high grown fines (a bright lingering bitterness mainly on the roof of the mouth), let the first second or two of the flow go into the drip tray. This is an old Italian barista trick for dealing with rioy Brasils, but it can also be used on gourmet blends containing a lot of acidy high grown coffees.
On the other hand, if the espresso tastes flat or bitter-dull, stop the extraction at a darker color to reduce the proportion of weak bitterish coffee, and increase the proportion of the intense flavors from early in the shot.
If the espresso is not sweet enough, you can do both by capturing the flow after a few seconds and ending while the flow is still darker. This "center-cut" shot will favor the sugars and caramels in the extraction.