As of this writing, the S&P 500 and Nasdaq Composite indexes are down a respective 10% and 17% so far in 2022. The global economy is slowing down, and some economists (and very loud market pundits) still think a recession is possible this year or next. And yet, stocks have rallied sharply off of their lows in mid-June.  

^SPX Chart

Data by YCharts.

Has a new bull market begun, or will recession send stocks lower? It's difficult to say. Either way, though, focusing on quality businesses that can grow despite macroeconomic issues is the way to go if you're a long-term investor. Three Fool.com contributors think Alphabet (GOOGL -1.97%) (GOOG -1.96%), LiveRamp Holdings (RAMP -1.14%), and Marvell Technology Group (MRVL 4.06%) will thrive no matter what happens next. Here's why.

This perpetual cash generator is being pushed by its CEO to improve even further

Billy Duberstein (Alphabet): Unsure of the way the economy's going to go? Then it's time to invest in companies with both offensive and defensive qualities. And I can't think of a better example than Alphabet, the parent company of Google.

On defense, Alphabet has three key attributes. First, Alphabet's core search business is an effective monopoly on global search, with more than 91% market share as of last month.

Not only does Alphabet have a near-monopoly on search, but search itself is a pretty defensive business, given that it doesn't require as much third-party data to effectively target ads. That's in contrast to social media platforms, which have been hurt by last year's IDFA privacy regulations that have limited their targeting capabilities. In a difficult advertising environment, Google search still grew 13.5% year over year last quarter, much better than the social media competitors, which all struggled. When prospective customers enter their search terms, they often have strong intentions of buying a product. For that reason, search ads are probably one of the last things advertisers would cut in an ad spending pullback. 

Another defensive quality is Alphabet's balance sheet, which has $125 billion in cash as of the end of the second quarter, with only $14.7 billion in long-term debt. Alphabet has been ramping up its buybacks in recent years, so if its stock price falls lower or stays at these lower levels, management can retire that much more stock without sacrificing growth opportunities. The company has a $70 billion buyback program currently underway, which could retire 4.5% of Alphabet's stock at today's market cap.

Third, Alphabet is a rising player in cloud computing. A late starter with the third-highest market share, Alphabet's Google Cloud Platform has still been growing nicely, up 35.6% last quarter to a $19 billion run rate. Since corporate customers generally save money and gain flexibility when they switch to the cloud, the cloud computing industry should remain relatively resilient on the whole, even if the economy goes into a downturn.

On the offensive side, if the economy improves, ad budgets will go up. That will not only benefit search advertising, but also Google's ad networks and YouTube, which has been growing viewership but has seen its growth take a hit amid the recent ad slowdown. Alphabet also has significant investments in artificial intelligence (AI) and new-age moonshot "other bets" projects that could receive more adoption if economic conditions improve. These include ventures in health data, fiber broadband, and self-driving car company Waymo, among others.

Given the softer macroeconomic backdrop, CEO Sundar Pichai recently sent a companywide email saying, "We need to be more entrepreneurial, working with greater urgency, sharper focus, and more hunger than we've shown on sunnier days."

So even though Alphabet remains highly profitable and has been weathering the current environment much better than others, Pichai is still pushing employees to do more with less. That should make Alphabet a defensive play that could surprise to the upside.

LiveRamp deserves a much richer price tag

Anders Bylund (LiveRamp): Data management and analytics expert LiveRamp Holdings offers a rare combination of robust growth and bargain-bin stock prices.

The company has close ties to the digital advertising market, where other businesses rely on its privacy-enhanced data collection and analysis tools to build and support their online marketing campaigns. LiveRamp's closest rivals tend to trade at sky-high valuations, often north of 20 times trailing sales. But this stock has been thrown out with the market's bathwater, changing hands at just 2.7 times sales today.

At the same time, LiveRamp has more than doubled its sales in four years. Data-driven advertising is a hot topic and this company is a veteran in that field. As a result, the company crushed Wall Street's estimates across the board in the recently reported first quarter of fiscal year 2023. Yet the stock keeps setting new multiyear lows, diving to prices not seen since 2018.

LiveRamp's high-margin Software-as-a-Service (SaaS) platform generates solid cash profits. The company reported free cash flows of $56 million over the last four quarters, based on $552 million in top-line revenue. LiveRamp's balance sheet holds $508 million of cash equivalents and zero long-term debt. Furthermore, LiveRamp's privacy-respecting data analytics platform is not easily replaced, which makes its customers highly loyal.

In short, LiveRamp's stock deserves the same double-digit price-to-sales ratios as SaaS giants Snowflake and The Trade Desk, both of which also happen to be close LiveRamp partners. Dollar-based net retention ratios clocked in at 113% in the first quarter, for example.

This stock is poised for a tremendous rebound. If there's another recession in the cards, it would only delay LiveRamp's return to a reasonable valuation. That looks like a lucrative journey if you're buying the stock at these bargain-bin prices.

The new-ish kid on the data center block

Nicholas Rossolillo (Marvell Technology Group): Everyone knows top semiconductor names like Nvidia and Advanced Micro Devices are making serious hay right now from a fast-evolving data center industry. But there are other chip companies getting massive lift from data center construction, AI, and related technology movements. If you haven't heard of it yet, let me introduce you to Marvell Technology Group.

Marvell has been around since the mid-1990s, designing chips for networking infrastructure. Its data processing units (DPUs) are at the heart of its semiconductor portfolio. These DPUs are specialized circuits responsible for moving and processing massive amounts of data within a data center. Nvidia has called the DPU the "third pillar of the computing world" along with central processing units (CPUs) and graphics processing units (GPUs).

Over the years, Marvell has steadily acquired smaller peers to expand into adjacent networking hardware like data center switches, data storage controllers, and ethernet products. As a result, Marvell is now a leader in networking hardware for applications from AI to cybersecurity to automotive computing. In fact, even though consumer electronics spending is poised for a cyclical decline in the second half of 2022, data centers and adjacent markets like 5G network infrastructure are still flying high. Most of Marvell's revenue is derived from these sources, not consumer products, so it is likely to remain in growth mode.

For reference, Marvell reported sales of $1.45 billion in the first quarter of fiscal 2023, ended April 30, and forecast a very healthy sequential increase in sales for Q2 ($1.515 billion at the midpoint of guidance). Management will report on Q2 on Aug. 25. Ahead of the quarterly report, Marvell stock trades for 41 times enterprise value to earnings before interest, taxes, depreciation, and amortization (EBITDA). It's a premium price tag, but rapidly improving as Marvell digests the effects of a couple of acquisitions in 2021. I'm a buyer right now.