It was 2011 when Marc Andreessen famously said, "Software is eating the world." Back then, investors didn't quite heed his prediction.

If the growth of software-as-a-service stocks over the past three years is any indication, Wall Street has finally caught on. Two of the biggest growers in this niche are e-commerce specialist Shopify (SHOP 3.75%) and customer-service-focused Zendesk (ZEN).

Since the start of 2017, these two have returned an average of 460% for investors. That's impressive. But which is the better buy today?

Picture of a digital globe.

Image source: Getty Images.

It's obviously impossible to answer that question with certainty. But we can get a better idea of what we're buying by comparing these companies on three different facets.

Financial fortitude

The first thing we'll evaluate is each company's financial fortitude. For this, we're exploring one question: If a financial crisis hit tomorrow, how would it affect the long-term prospects of each company?

Companies with lots of cash on hand, for instance, can actually get stronger from such times. They drive competition out of the market, buy back their own shares at a discount, and even acquire smaller rivals.

Keeping in mind that Shopify is valued at roughly five times the size of Zendesk, here's how they stack up.

  Cash Debt Free Cash Flow
Shopify $2.0 billion $114 million $10 million
Zendesk $798 million $0 $40 million

Data source: Yahoo! Finance, SEC filings. Cash includes long- and short-term investments. Free cash flow presented on trailing-12-month basis.

It's worth noting that Shopify's balance sheet is probably even stronger. The company recently had a secondary offering that added more than $600 million in cash to the balance sheet, though exact numbers have yet to become available.

That said, these two are pretty much on even footing: They each have lots of cash and almost no debt and have just started becoming free cash flow positive. As such, I think they're both very healthy. This one is a draw.

Winner = Tie

Valuation

Next we have a more difficult thing to measure: how expensive each stock is. There's no single metric that can do the trick for us. Instead, we have to consider lots of different data points.

  P/E P/FCF P/S PEG Ratio
Shopify 630 390 30 9.5
Zendesk 250 200 11 5.5

Data source: Yahoo! Finance, E*Trade. P/E presented with non-GAAP earnings.

I won't mince words: Using the type of valuation that has been popular in the stock market over the past 50 years, both of these stocks are crazy expensive. Investors have obviously warmed to the SaaS business model, but that has driven valuation to stratospheric levels.

But in this exercise, we're comparing two companies against each other, not against the market or history in general. Viewed through that lens, Zendesk is obviously the better choice, as it is cheaper on every available metric.

Winner = Zendesk

Sustainable competitive advantage

We've saved the most important variable for last: a company's sustainable competitive advantage, or "moat." Both of these companies have the same core moat: high switching costs.

When a merchant sets up a website, payment, shipping, and analytics tools on Shopify, why would they ever want to go through the hassle of changing to a different provider? And if you use Zendesk for everything from customer-interaction logs to chat to analyzing all the data you've collected, would you ever do anything to jeopardize all of that data?

The short answer is no -- and that's why both of these companies are not only able to retain most of their customers but get them to add more solutions over time.

Shopify, however, has additional moats that give it the edge. For one, the company's app store benefits from growing network effects. Third-party app developers build tools for Shopify merchants that don't cost Shopify a dime. But the company gets a portion of each sale. The more merchants that join, the more app developers are drawn to the platform.

Furthermore, Shopify is creating its own fulfillment network. The theory is that this network will challenge Amazon's superiority and give merchants an agnostic choice (read: Shopify won't steal business from its merchants like Amazon does). If Shopify is successful, it will also have a moat in terms of low-cost production (of fulfillment).

Winner = Shopify

And my winner is...

So there you have it: two expensive stocks with impressive balance sheets. Technically this is a tie. Whenever that's the case, I give the nod to the company with the widest moat. In this case, that's Shopify.

But I think both stocks are worthy of your attention. I own them both, and they account for 13% of my real-life investments. Ten years from now, you'll be glad you considered -- and invested in -- both.