Practice, practice, practice. I remember when flats were a challenge, but I've been riding more than 30 years, and certainly fixed hundreds of flats if you count those on my kids' and my wife's bikes. Barring complications, i can dismount a tire, strip out the tube, install the spare and pump it up with a frame-fit pump in 3 minutes, 3:15 tops. Patching, if I have to do it, adds a couple of minutes. If you're going to be riding a lot, a few tips:
Really do practice. You should be able to take the rear wheel off the bike in 10 seconds (put the chain in the small ring and small cog, open the quick release, pick the bike up by the seat and hit the top of the tire with the heel of your hand. Takes longer to write about than to do).
Before you install a new tube, put a little air in it, just enough so it will hold its shape. If you're using presta valves, you can do it by mouth. That helps prevent catching a fold of the tube between the tire bead and the rim.
Put the tire on the rim so the label is right at the valve. Then when you get a puncture, you can see where it is on the tube and check that portion of the tire for the offending object. Easier than scanning the whole tire.
My failure rate with "glueless" patches is 50 percent on road tires. I don't use them. I don't like CO2 for the reasons other posts have given, plus I don't like throwing the carts away. I do have two minipumps, but they take nearly 400 strokes to bring my 35mm tires up to pressure. A good frame-fit pump will do it in fewer than 100.
Flat tires are absolutely a part of cycling. I average about one a week, 150-200 miles in summer. Might as well learn to deal with them.