On any given day, ExxonMobil's (XOM 1.15%) ranks right up there with Apple (AAPL -1.22%) as one of the top companies in the world by market capitalization. Depending on what investors think of Apple that day, it'll claim that top spot. The two are an odd pair -- not only are they engaged in nearly polar opposite industries, but each also takes an opposite approach when it comes to the massive cash flows they generate.

Over the past decade, ExxonMobil has spent $207 billion to buy back its own shares. No matter how you look at it, that's a lot of money. It's more money than the market capitalization of all but 11 members of the S&P 500. The question is whether buybacks are the best place for the company to spend its riches. 

Companies have an array of options to use their excess cash with buybacks but one avenue to funnel that excess. Those same funds could have been used to increase the company's rather low 2.6% dividend, or they could have been banked for a rainy day the way Apple has done with its fat $100 billion rainy-day fund. Given that we've not seen a day that rainy since biblical times, Apple investors are crying for the company to do something with its cash hoard.

A big buyback would certainly provide a nice short-term boost to Apple's shares but most companies are terrible at buying back their own stock. Typically, they buy high and sell low. Despite spending billions to buy back its own stock, even Exxon missed the bottom in its shares by holding back as we move out of the credit crisis:

Source: The Wall Street Journal.

If even Exxon isn't an expert at buying back its shares, should it really be doing so at all? Is it simply buying back shares just because it has the cash, or is there a plan behind the buyback? The company really only should be doing something with its excess cash if it doesn't have other opportunities to grow its business. We'll call this the Warren Buffett approach. As you probably know, Buffett has notoriously eschewed both dividends and buybacks at Berkshire Hathaway (BRK.B 1.30%).

More recently, Buffett has changed his buyback tune, but only if his company's shares meet two very important conditions. The first one goes without saying -- the company needs ample liquidity to ensure it can pay its bills. The second condition is that the stock needs to be selling at a material discount to the company's intrinsic value. I'd add that there's always been a third condition: Buybacks are only for cash that's not needed to grow the business.

Therein lies the problem with Exxon's buyback. It's buying its shares back at a premium to its peers, and given our voracious energy appetite, there's sure to be opportunities to grow.

Those opportunities could come from acquiring companies that are trading at a discount, and there are many, or simply by increasing its drilling budget. Believe it or not, Exxon really excels when it invests cash back into its business. Last year the company earned a 25.4% return on the capital deployed and has averaged just under a 25% return since 2008. For some context,  Chevron's (CVX 1.54%) returns over the same period were closer to 20%, while Royal Dutch Shell (RDS.A) managed only 15% returns. Given its success in deploying capital, how good is Exxon at growing its oil and gas production?

Here's where those buybacks are a bit deceptive. An oil company should continually increase its oil and gas production, especially if prices are heading higher. Exxon's production per share increased 48% over the past decade. However, in absolute terms its production is just up about 1% annually. When you think about it, despite not always buying back its stock at cheap prices, the buybacks did add tangible value to each investor's shares.

The company is so good at buying back its own shares that it's taken is share count down from 7 billion after the Exxon-Mobil merger all the way down to the 4.5 billion it has outstanding today. The company did the same thing after issuing shares to buy XTO, as it's taken its share count down by nearly half a billion since that merger.

Most companies are terrible at buying back their own stock. Exxon is not one of those companies.

However, can you imagine the cash flow the company would be producing today if it wasn't buying back all those shares? It's now lagging behind its peers in production growth because of all those buybacks. Has its disciplined approach caused it to fall behind? Stay tuned to Fool.com tomorrow for Part Two: Is the ExxonMobil empire crumbling?