Excerpt from “Source Code: My Beginnings” by Bill Gates

0
99
Excerpt from “Source Code: My Beginnings” by Bill Gates

source-code-cover-1280-knopf.jpg

Knopf

We may receive an affiliate commission for purchases made through the links in this article.

In his latest autobiography, “Source Code: My Beginnings” (set to release on February 4 through Knopf), Bill Gates, the renowned computer innovator and philanthropist, reflects on his early life and the journey that brought him into the emerging field of computing.

Below is a fascinating excerpt detailing his encounter with BASIC in the eighth grade, which ignited his passion for the precision and beauty of computer programming. And be sure to check out Lee Cowan’s interview with Bill Gates on “CBS Sunday Morning” on February 2!


“Source Code: My Beginnings” by Bill Gates

If you prefer listening, check out Audible’s 30-day free trial available now.


Even after all these years, I am still amazed by the confluence of events that made it possible for me to use a computer in 1968. The leap of faith taken by the educators and parents who provided the terminal, combined with the fortunate timing of computers being shared over phone lines, was essential. The creation of the BASIC programming language by two Dartmouth professors completed this miracle. Only four years old at the time, BASIC (which stands for “Beginners’ All-purpose Symbolic Instruction Code”) was designed to facilitate programming for those in non-technical disciplines. It utilized intuitive commands like GOTO, IF, THEN, and RUN, which resonated with those of us who were new to this field. BASIC captivated me and sparked my desire to delve deeper.

Adjacent to the terminal, a teacher had pinned a small sheet of paper featuring basic instructions on how to begin, including logging in and resolving common issues. It ominously cautioned that typing “‘PRINT’ WITHOUT A STATEMENT NUMBER MAY CAUSE LOSS OF CONTROL.”

This sheet included a sample BASIC program illustrating how to add two numbers.

Ready . . .

10 INPUT X,Y

20 LET A=X+Y

30 PRINT A

40 END

This was the first computer program I ever entered. The clarity of those four lines of code appealed to my sense of order. The instant result felt electrifying. That experience led me to create my first program—a tic-tac-toe game. In crafting it, I had to thoroughly think through the fundamental rules of the game. I quickly realized that the computer was a simple machine that required explicit instructions for every possible scenario. My initial vague coding often led to errors, and each correction brought a tremendous sense of achievement, even though a game as simple as tic-tac-toe is easily grasped by children.

I appreciated how the computer compelled me to think. It was unforgiving of any mental shortcuts, demanding logical consistency and meticulousness. A misplaced comma or semicolon could break everything.

This was reminiscent of solving mathematical proofs. Programming doesn’t require advanced math skills, but it demands a rigorous logical approach to problem-solving, breaking tasks into smaller, manageable pieces. Similar to algebra, there are numerous methods to write functioning programs—some more elegant and efficient than others—yet an infinite variety of ways to create a failing program. I encountered my share of failures, and only through persistence and smart thinking was I able to get a program to run seamlessly.

One of the first complex programs I developed was a lunar lander game. The objective was to land the lunar lander safely on the moon without crashing and before running out of fuel. This required systematically analyzing the game mechanics—how the player could maneuver the lander in different directions, manage fuel levels, and visualize the lander on-screen using dashes and asterisks.

Shortly after the terminal was installed at Lakeside, Mr. Stocklin ran a program containing an infinite loop, causing it to run indefinitely until someone stopped it—this, of course, consumed over a hundred dollars from our limited rummage-sale budget. After that, I don’t think he showed his face in the computer room again. It was a lesson well-learned by all of us.

To avoid incurring charges, I would write as much code as I could on paper before inserting my spot at the computer. While the terminal was offline to save money, I would type it in, and the output would print onto rolls of narrow paper tape. That was just the first step. Then I’d dial the rotary phone on the side of the terminal, waiting for the modem’s buzzing confirmation that I was connected. After inserting my tape, the program would input at a rapid ten characters per second. Finally, I’d type “RUN.” Usually, a lineup of other kids would be waiting for the computer, so if my program didn’t operate correctly, I had to log off and figure out where the mistake was, then wait my turn to return to the teletype.

This feedback loop was compelling. The thrill of improving continuously was exhilarating. Writing programs came naturally to me, thanks to my logical thinking and an ability to focus intensely for long periods. Moreover, programming fulfilled my ceaseless need to demonstrate my capabilities.

The atmosphere in that computer room was a (mostly) healthy blend of collaboration and competition. We were a frenzied group of teenage boys, each attempting to surpass the others. Even a two or three-year age difference feels significant when you’re thirteen. Kent and I were among the youngest in the group, and the presumed superiority of the older kids occasionally got under our skin.

I was an eighth-grader brimming with confidence in my mental abilities, convinced that my dedication meant I could match or even exceed the older boys—if not in skill, then in speed. I was determined to keep up with the pace. Kent felt similarly about not being looked down upon.

One sophomore, Paul Allen, quickly identified this and leveraged it perfectly. “Bill, if you’re so smart, you can solve this problem.” Those were some of the first words uttered to me by the person who would eventually become my co-founder at Microsoft.

Excerpted from “Source Code: My Beginnings” by Bill Gates. Copyright © 2025 by Bill Gates. Excerpted by permission of Alfred A. Knopf, a division of Penguin Random House LLC. All rights reserved. No part of this excerpt may be reproduced or reprinted without permission in writing from the publisher.


Get the book here:

“Source Code: My Beginnings” by Bill Gates

Buy locally from Bookshop.org


For more info:




How Bill Gates knew he was different
08:53