They bonded over their passion for computer programming, then in its earliest days. In the late 1960s, the private school's faculty members banded together to get a computer terminal , machinery which at the time was rare and prohibitively expensive. At Lakeside, Gates and Allen learned how to dissect computer code together, Allen wrote in his memoir.

Allen and Gates had been "partners in crime" since their days at Lakeside School in Seattle, according to the 2012 memoir Allen wrote, "Idea Man." The two met when Gates was just in eighth grade and Allen was in tenth grade.

This week, Bill Gates mourned the passing of Paul Allen , his Microsoft co-founder and long-time friend. The two had been close since high school and if it weren't for a business the two founded as teens, Microsoft might never have existed.

One summer during high school, Gates worked for a company that measured traffic flow patterns by counting the car wheels that rolled over pressure-sensitive rubber tubes. Every 15 minutes, a machine would punch a pattern of holes onto a piece of paper tape. This tape would be read manually and its results written down manually. "The process was monotonous, inefficient, and murder on the eyes," Allen wrote.

Gates and Allen felt this process could be done more efficiently and more inexpensively, an idea that soon evolved into the friends' first-ever business: Traf-o-Data. At the time, Gates was nearly 17 and Allen was 19.

Gates began hiring younger students at Lakeside to serve as human paper-tape readers who would then copy a tape's data onto computer cards. Gates paid each student fifty cents a tape, wrote Allen.

Gates and Allen then used a computer at the University of Washington library (where Allen's father worked) to create "easy-to-read" data charts on hourly traffic flows.

Eventually, a third partner joined the company and built a machine to automate the reading of the tapes. They'd later scrape together $360, or $2,300 in today's dollars, to buy a special-ordered 8008 microprocessor chip for what became the Traf-o-Data machine. "That's a lot of money for such a little thing," Bill reportedly said at the time.

With Traf-o-Data, the boys made analyzing traffic data for the Washington state roads department much easier. Traf-O-Data later expanded, charging $2 per day for data collection to clients including small counties near Seattle and a district in British Columbia. Allen wrote, "In that first flush of entrepreneurship, we had grandiose dreams about the money coming our way."

The company ran for years, continuing after the two had left high school, quit college and even after they'd founded Microsoft. However, just as the company's business began to pick up, Washington and other states started offering the same service for free.

By that time, Allen said, he was preoccupied with running another company in Seattle with Gates — Microsoft. They reportedly netted nearly $20,000 for their work with Traf-o-Data, but the data-gathering project ultimately flopped. Allen said:

"In hindsight, Traf-O-Data was a good idea with a flawed business model. We had done no market research. We hadn't foreseen how hard it would be to get municipalities to make capital expenditures, or that officials would be reluctant to buy machines from students."

Despite Traf-O-Data's limited success, Allen has said it was essential in preparing them to make Microsoft's first product a few years later. While Traf-O-Data was a business failure, he wrote in 2017, it helped them understand microprocessors, knowledge that was "crucial to our future success."

"If it hadn't been for our Traf-O-Data venture," said Allen, "and if it hadn't been for all that time spent on [University of Washington] computers, you could argue that Microsoft might not have happened."

This experience laid the groundwork for their success in technology, said Allen. "In my experience, each failure contains the seeds of your next success — if you are willing to learn from it. Bill and I had to concede that our future wasn't in hardware or traffic tapes," wrote Allen. "We'd have to find something else."

Paul Allen died of cancer yesterday at the age of 65. Gates said that he was "heartbroken" about the passing of one of his "oldest and dearest friends."

"From our early days together at Lakeside School, through our partnership in the creation of Microsoft, to some of our joint philanthropic projects over the years, Paul was a true partner and dear friend," said Gates in a statement.

Said Gates, "Personal computing would not have existed without him."

Like this story? Subscribe to CNBC Make It on YouTube!

Don't miss: