Two of the leaders in cloud computing -- salesforce.com (CRM -1.59%) and Veeva Systems (VEEV 0.17%) -- share the same DNA. And that DNA has treated shareholders very well.

But this shouldn't be surprising: In the early aughts, Peter Gassner was an executive at Salesforce. One of his tasks was selling the company's customer relationship management (CRM) solution to drug companies. He realized that because of industry dynamics and regulatory hurdles, Salesforce's solutions weren't specialized enough to meet the industry's needs.

So, in 2007, he decided to put his own skin in the game: he left Salesforce, founded Veeva, and turned his focus to the pharmaceutical industry's cloud needs. The results have been impressive, and Veeva shareholders have been rewarded -- the stock has returned more than 170% since mid-2014.

A father and son looking at each other with shaving cream on their faces.

Who will win in the battle of father (Salesforce) vs. son (Veeva)? Image source: Getty Images.

Does that mean that the younger upstart -- Veeva -- is a better buy today than its older predecessor? It's not quite that easy to answer. Let's consider three lenses through which we can view the question, and hopefully come to a better understanding.

Sustainable competitive advantages

There's nothing more important -- or difficult -- for an investor to measure than a company's sustainable competitive advantages. This "moat" represents the special something that differentiates a company from the rest of the field. It's what keeps customers coming back year after year, and keeps the competition at bay for decades.

Both Veeva and Salesforce benefit from a very powerful moat: a subscription-based model of software-as-a-service that has high switching costs.

Let's use Veeva as an example. Drug companies initially started using Veeva's CRM solution to help unify and streamline their salesforce. After a while, they were impressed with the software, so they started using Veeva Vault. In Vault, a company can manage clinical drug trials, collect important data, and make sure the necessary regulatory guidelines are being followed. And this is all on one platform.

Now imagine that an executive wants to switch away from Veeva. That would involve lots of money and headaches to retrain an entire workforce, the possibility of losing mission-critical data, and a whole lot of headaches. Once a drug company is in the Veeva ecosystem, it would need strong motivation to leave -- either awful software, or prohibitively expensive subscription fees.

That's what high switching costs look like. And because Veeva and Salesforce have essentially the same business model, I'm going to call this a tie, as they both benefit from said moat.

Winner: Tie.

Financial fortitude

We should never underestimate the importance of having a hefty cash stash. While a company that pays dividends, buys back its own shares, or reinvests aggressively in its own growth is exciting, a boring lump of money sitting in the bank is vital.

That's because every company at one point or another will face difficult economic times. When those times hit, having cash is huge. It allows a company to buy back shares on the cheap, make timely acquisitions, or -- most importantly -- outspend rivals to gain market share. Debt-heavy companies have no such options.

Here's how Veeva and Salesforce stack up in terms of financial fortitude, keeping in mind that Salesforce is valued at over eight times the size of Veeva.

Company

Cash

Debt

Net Income

Free Cash Flow

Veeva

$511 million

$0

$65 million

$143 million

Salesforce

$2,776 million

$2,008 million

$180 million

$1,700 million

Data source: Yahoo! Finance.

Both of these companies are in relatively healthy situations. I'm a much bigger fan of Veeva's balance sheet, as it sports absolutely no long-term debt. But we can't overlook the fact that Salesforce's free cash flow is prodigious. Given the reliability of its subscription-based revenue, this is an enormous plus.

In the end, I think these two forces balance each other out and create a tie.

Winner: Tie.

Valuation

Finally, we have valuation. While this isn't an exact science, there are some straightforward metrics we can consult to give us an idea of how expensive each stock is.

Company

Forward P/E

P/FCF

PEG Ratio

Veeva

67

48

3.0

Salesforce

83

34

2.3

Data sources: Yahoo! Finance, E*Trade, Nasdaq.com. P/E represents figures from non-GAAP earnings.

Don't be mistaken: These are both expensive stocks by traditional metrics. If I was forced to, I would give a slight edge here to Salesforce. The company's PEG ratio and P/FCF both having it trading at about a 30% discount to Veeva.

Winner: Salesforce.

The winner is...

So there you have it. Salesforce wins, but just by a hair. It's worth noting that while I don't own shares of Salesforce, Veeva has become a mainstay in my portfolio -- with a current allocation of 3.5%. But I think both of these companies are worthy of your consideration.

And incidentally, Veeva maintains its cloud software on Salesforce's infrastructure. The two companies also just announced a deepening of their partnership in selling some Veeva products outside the life-sciences industry. I wouldn't at all be surprised to see these two continue to work together in the future. As I said before, they share the same DNA -- and in this case, that's a very good thing.