Gabriel Guimaraes grew up in Vitória, Brazil, in a yellow house surrounded by star-fruit trees and chicken coops. His father, who wrote software for a local bank, instilled in him an interest in computers. On weekends, when Guimaraes got bored with Nintendo video games, he programmed his own. In grade school, he built a humanoid robot and wrote enough assembly code to make it zip around his home. In Vitória, an island city, his most ambitious peers dreamed of attending university in São Paulo, an hour away by plane. Guimaraes set his sights on the Massachusetts Institute of Technology. By the time he was in high school, M.I.T. had released hundreds of its classes, free of charge, on the Internet, as a series of massive open online courses, or MOOCs. Guimaraes sampled the introductory computer-science class, but he found the lecturer, a “white-haired guy in front of a blackboard,” crushingly dull. In 2011, trawling YouTube for other course material, Guimaraes clicked on a lecture from Harvard’s introductory computer-science class, CS50, which was taught by a young professor named David Malan. Almost instantly, Guimaraes told me, he felt himself “hypnotized.”

Malan, who had glossy black hair and an energetic mien, lectured from a grand auditorium on Harvard’s campus. In the first class, he illustrated an algorithm called binary search by inviting a volunteer onstage to find “Mike Smith” in the Yellow Pages; at Malan’s urging, the student opened up the phone book to a random spot, tore off the half of the book without the right name, and then repeated the process, halving the volume again and again, until only the desired page remained. Malan’s assignments, too, eased students into the arcana of computer science. Before learning C, a low-level programming language with finicky syntax, they created animated games in Scratch, a visual programming language designed for children. For a forensics problem set, inspired by a summer that Malan spent working in a district attorney’s office, students were asked to write code to restore a set of deleted photo files. “It felt like the coolest video game I’d ever gotten my hands on,” Guimaraes said.

On Harvard’s campus, CS50 culminates in a festive exposition, where students show off their final coding projects and hobnob with technical recruiters from companies like Facebook and Google, many of whom are alumni of the class; Malan provides a bevy of free paraphernalia, including CS50-branded stress balls and T-shirts that read, “I TOOK CS50.” In Brazil, Guimaraes decided to conduct his own final project: a re-creation of Malan’s course materials and lectures in Portuguese. In his sophomore year of high school, he taught CC50Ciência da Computação Cinquenta—to his peers, during eleven weeks of the fall term. When Guimaraes arrived for the first class, bearing, as Malan did, a gargantuan sheet cake as a welcome treat, he found about a hundred students snaking out the door. Dressed in a baggy Harvard shirt that he’d bought online, he delivered Malan’s first lecture, repeating the phone-book demonstration with an old dictionary. CS50’s course materials were freely distributed under a Creative Commons license, but, as a courtesy, Guimaraes had e-mailed Malan’s staff a heads-up about his project. During the sixth week of his lectures, he received a gift box from Malan, stuffed with CS50 swag.

Malan, who took over CS50 in 2007, was a pioneer in distributing Harvard course materials online for free. In 2012, Harvard and M.I.T. launched their own online-learning platform, edX, which today offers several thousand MOOCs—both digital editions of existing university courses and original certificate programs designed by Microsoft, I.B.M., and other technology giants. But few, if any, combine the institutional credibility, the enormous reach, and the zealous engagement of Malan’s. In the decade since Guimaraes took it, CS50 has inspired satellite operations on every continent except Antarctica. Though most of the students who sign up for the edX version—more than two million to date—quit before finishing, those who stick with it often become diehards: earlier this year, in Baghdad, students restaged Malan’s project fair at al-Hikma University with identical trimmings, down to the emoji-shaped balloons and the custom “debugging” rubber ducks. To promote the expansion of CS50, Malan films welcome teasers for the remote cohorts, hosts annual educator workshops, and helps prop up outposts around the world. CS50 is less a single course than an “ecosystem of courses,” as one staff member put it, with spinoffs designed for specific audiences: lawyers, business students, gamers. In 2015, Harvard’s computer-science department launched an unprecedented partnership with Yale, live-streaming Malan’s lectures from Cambridge to New Haven.

Malan’s investment in virtual learning has transformed the way that students engage with the class at its home base, too. CS50 is one of Harvard College’s most popular courses; it’s also the only one that students can watch live, in high definition, from their dorms. In the past, Malan has encouraged them to do so, writing, in a blog post from 2016, that it might well be “a better educational experience to watch CS50’s lectures online than attend them in person.” Prioritizing remote teaching to such an extent is still a rarity among Harvard professors. Even Michael Sandel’s Justice, another flagship Harvard lecture course, whose online counterpart predates CS50 and was broadcast on PBS, has little of Malan’s technological infrastructure. In March, when the coronavirus pandemic forced universities across the country to migrate classes online, no more than five hundred Harvard instructors had virtual teaching experience, the university’s president, Lawrence Bacow, told me in an e-mail. In a matter of days, the number “jumped to about three thousand,” the size of Harvard’s entire teaching staff.

For many professors, the sudden transition was a struggle. For Malan, it was the natural extension of a decade’s worth of experimentation. “Our team is fortunate to have been doing this blend of education for quite some time,” he told me recently. “For us, it was very straightforward.” Malan’s contract at Harvard allows him to focus almost exclusively on CS50; even the research he publishes centers mainly on the class. In the spring, he happened to be piloting a small version of CS50, historically a fall course, using online-only lectures filmed in the previous term. The pandemic prompted him to move parts of the curriculum—office hours, a weekly tutorial, the project fair—to Zoom. But, while his colleagues were scrambling to retool their classes for virtual platforms—troubleshooting unfamiliar technology, shortening lessons, building in interactivity—the substance and presentation of CS50, as one student wrote in an end-of-term evaluation, “pretty much stayed the exact same.” Malan’s method of remote teaching is not easily replicable; CS50’s pyrotechnics would not be possible without an unusually deep well of resources and his own fanatical commitment. But, as universities attempt to reopen safely in the fall, with online learning at the forefront, the course’s spread and success provide a glimpse of where higher education might be headed.

One muggy morning in June, Malan visited Harvard’s campus. Sanders Theatre, where he lectures, was still officially closed, but a few members of CS50’s staff had received special permission to enter. I found Malan at a side door. He was wearing a mask and, over one shoulder, carried a backpack containing two laptops. Inside, signs in Harvard’s colors encouraged hand washing and social distancing. Doors had been propped open, to reduce human contact with knobs and handles; a red brick, stationed on the floor outside the bathroom, could be kicked aside to signal that someone was inside. Harvard had not yet finalized its reopening plans, but the university had released an interim report earlier in the week, stating that, “regardless of whether students are on campus, learning will be remote next year, with only rare exceptions.” For more than two months, Malan had been holding CS50’s office hours online, both for his Harvard class and, separately, for outside students, in sessions open to the public. Now he was going to try streaming his office hours from Sanders, to see how it would feel to teach there, in the fall, with only a virtual audience. More than a thousand students, from a hundred and nine countries, had registered to attend the day’s session.