“Women are ‘naturals’ at computer programming.” So said the pioneering programmer Grace Hopper in a 1967 Cosmopolitan article. Programming, she explained, is “just like planning a dinner”: It requires advance preparation, patience, and attention to detail.

Hopper, who, in 1946, was part of the team that developed ENIAC, the first electronic digital computer, established herself in the pre-brogrammer age. During the 1940s and 50s, it was primarily women, not men, who were developing code for the nation’s first computers, and the accompanying pay and prestige were both relatively low. But as the century progressed and the field of computing became male-heavy, compensation and esteem both rose precipitously—despite the fact that the substance of the job remained similar.

How did programming transform from a feminine field into an occupation synonymous with young men wearing hoodies who collect generous salaries for hacking and disrupting things? The story behind the fluctuations in programmers’ salaries and cultural status—as well as those of other professions whose gender composition has shifted over the years—sheds light on how and why women’s work is, across the economy, considered to be less valuable than men’s work. It also provides a rebuttal to the common argument that the gender-pay gap exists because women tend to choose less demanding jobs that pay less.

* * *

In the early years of computing, the area that garnered respect was hardware development, which was thought of as manly work. Meanwhile, the work most women performed, programming, lacked prestige. The gender makeup of programmers and the status of the job were mutually reinforcing. Women were hired because programming was considered clerical work, a bit of plug-and-chug labor that merely required women to set into motion preset plans.

Programming was later recognized to involve complex processes of analysis, planning, testing, and debugging. Initially, though, the job was poorly understood. Janet Abbate, a professor of science and technology in society at Virginia Tech, explains in her book Recoding Gender that, in the absence of a concrete grasp on the job, “gender stereotypes partially filled this vacuum, leading many people to downplay the skill level of women’s work and its importance to the computing enterprise.” Notably, where more egalitarian gender roles prevailed, so did the job options available to women in computing. While American and British women were effectively barred from building hardware during the mid-20th century, women in the relatively more equitable Soviet Union helped construct the first digital computer in 1951.

By the time Cosmopolitan was interviewing Grace Hopper, the field was already taking a masculine turn. Aptitude tests and personality profiles, which were the primary mechanisms used to screen and rank job candidates in programming in the 1950s and 60s, helped accelerate the profession’s shift from female to male. These measures, which hiring managers considered to be objective, often told employers less about an applicant’s suitability for the job than his or her possession of frequently stereotyped characteristics. Tests like the widely used IBM PAT primarily focused on mathematical aptitude, even as industry leaders argued that such skills were becoming irrelevant to contemporary programming—the conclusion of a paper presented at a 1957 computing conference was that the correlation between test scores and performance reviews on the job was not statistically significant. The type of math questions on these multiple-choice exams—requiring little nuance or context-specific problem solving—were often testing skills that men were more likely than women to have learned in school at a time when girls were more likely to be steered away from STEM subjects.

A growing reliance on personality profiles—exams intended to identify the less tangible qualities that adept programmers possess, like ingenuity—only added to this effect. After two prominent psychologists noted that programmers shared the “striking characteristic” of “their disinterest in people” companies began seeking out antisocial applicants. A feedback loop ensued. The historian Nathan Ensmenger writes in The Computer Boys Take Over that these multiple-choice assessments spurred the overrepresentation of workers with these stereotypically masculine characteristics, which “in turn reinforced the popular perception that programmers ought to be antisocial and mathematically inclined (and therefore male), and so on ad infinitum.” Over time, the gender balance tipped further in men’s favor. In the 1950s, women comprised between 30 and 50 percent of programmers. As of 2013, women made up about one-quarter. Accompanying men’s takeover of the field in the late 1960s was an immense climb in pay and prestige.

Software development is but one example of an occupation whose gender composition completely changed over the course of decades. Teaching also experienced a turnover in the gender of its staff, but the direction of the trend was reversed, with women replacing men as educators. And when they did, the salaries and status of the profession dropped sharply.

In the early 1800s, men tended to be in command of classrooms. By the middle of the century, as public education became widespread, teachers were in high demand, and new hires were pulled from a relatively dormant female labor pool. As women entered the profession en masse, a new conception of teaching emerged. Whereas male teachers had been expected to impart knowledge and discipline, female teachers were charged with guiding their pupils’ moral development. As Dana Goldstein points out in her book The Teacher Wars, female educators were expected to be neither authoritarians nor disciplinarians, but rather to uphold a “motherteacher” ideal—that is, to perform the role of mothering, but in the classroom instead of the home.

As in the case of programming, the mere presence of women in teaching did not necessitate revising perceptions of women, but perceptions of the job. Aspects of teaching considered more feminine, like nurturance, became emphasized. Goldstein writes that “during an era of deep bias against women’s intellectual and professional capabilities, the feminization of teaching carried an enormous cost: Teaching became understood less as a career than as a philanthropic vocation or romantic calling.”

Like other labor performed for altruistic reasons, teaching—at least when done by women— pulled in scant wages. Gender and pay were part of the same story. Women were allowed into the profession in large part because they could be compensated less than men for the same labor. For some, paltry pay was even a selling point of hiring female teachers. Catharine Beecher, a prominent 19th-century education advocate, touted the proposed savings to taxpayers as one of the benefits of hiring female teachers. Taxpayers certainly got a bargain: In 1905, male elementary teachers earned double what their female colleagues did.

Beecher, it turns out, foretold the future of the teaching field: It would go on to become a “feminine” and meagerly paid occupation. By 1900, teaching was an overwhelmingly female profession, though men would continue to dominate the leadership roles in the field of education. Now, 76 percent of public-school teachers are women—and teaching remains modestly paid compared to similar jobs.

* * *

Gender-pay-gap skeptics often dismiss the disparity between men’s and women’s average earnings by arguing that women simply choose to work in lower-paid occupations. In a 2014 press release, the Republican National Committee employed this logic to contest the oft-cited statistic that female full-time workers make only 77 cents for every dollar a man earns: “There’s a disparity not because female engineers are making less than male engineers at the same company with comparable experience. The disparity exists because a female social worker makes less than a male engineer … The difference isn’t genders; it’s because of their jobs.”

The crux of this argument is correct. Occupational segregation persists, and the fields that women dominate tend to pay less. Indeed, in a recent study, the Cornell University economists Francine Blau and Lawrence Kahn examined data between 1980 and 2010 and found that the gender segregation in occupations and industries “are quantitatively the most important measurable factors explaining the gender wage gap.” Equal pay and gender segregation have consistently had a strong inverse relationship; the greater the gender segregation in the labor market, the larger the disparity between men’s and women’s wages has been. It’s no surprise, then, that the U.S. hasn’t seen an improvement on either front since the 1980s.

But in this debate over earnings, the sticking point is how pay-gap skeptics interpret the wage disparity between female- and male-dominated industries. The logic employed by the RNC and others assumes that pay is a clear reflection of a job’s difficulty or importance, that female-dominated fields pay relatively poorly because the work is less challenging or of less societal worth.

But the histories of programming and teaching, which illustrate how the same job can be framed and compensated differently over time, poke holes in this interpretation: It seems that the gender composition of an occupation helps determine pay and prestige.

Scholars have attempted to understand why occupations with a greater share of women pay less that those with a smaller proportion, even when they require the same level of education and skill. Research by the sociologists Asaf Levanon, Paula England, and Paul Allison presents a similar story to those of programming and teaching. A study of theirs, which examined Census data from 1950 to 2000, found that when women enter an occupation in large numbers, that job begins to pay less, even after controlling for a range of factors like skill, race, and geography. Their analysis found evidence of “devaluation”—that a higher proportion of women in an occupation leads to lower pay because of the discounting of work performed by women.

Female- and male-dominated jobs of similar worth to an organization are often not equivalently paid. A study from 2007 that examined skills needed for certain jobs found that men’s low-wage jobs demand far less in terms of skill, education, and certifications than women’s low-wage jobs, yet the male-dominated ones usually command higher hourly pay.

Relatedly, Jessica Pan, an economist at the National University of Singapore has shown that there is a tipping point at which men flee an occupation. Pan suggested that, in the absence of perfect information, workers take the percentage of female employees as a proxy for an occupation’s prestige. Even children pick up on this differential valuing of men’s and women’s work. Experimental research has found that when children were shown images of male workers on the job, they viewed those jobs as having higher status than when those same jobs were depicted with female workers.

It’s clear that biases are at work, but how exactly are they operating? For one thing, conceptions of “expertise” are inseparable from gender. As Judy Wajcman, a sociology professor at the London School of Economics, has argued, “The classification of women’s jobs as unskilled and men’s jobs as skilled frequently bears little relation to the actual amount of training or ability required for them. Skill definitions are saturated with gender bias.” Gender stereotypes pervade definitions of competence and status, contrasting work that requires brain or brawn; mathematical or verbal ability; individualism or cooperation. When an occupation undergoes a shift in gender composition, the description of the job often morphs to better align with the gender of the incoming hires—such as when programming went from being understood as clerical work suitable for women to a job that demands advanced mathematical facility. When women replaced men as typists, it went from a job that was seen as requiring physical stamina to one that needed a woman’s dexterity.

This isn’t to suggest that gender segregation in the labor market explains unequal pay on its own. Even when women work in male-dominated fields, a pay gap persists. The Harvard economist Claudia Goldin found that the majority of the pay gap between men and women results from differences within occupations, not between them. For example, female doctors and surgeons make 71 percent as much as their male counterparts, after controlling for age, race, hours, and education. The gap widens in the highest paying professions, like finance and law. Women who get mommy-tracked and women who take on shorter hours also contribute to the pay gap, particularly in high-skilled jobs. But these choices about how to arrange work are hardly made freely. They happen in the context of a nation with no federal paid parental leave for mothers or fathers, virtually no subsidies for childcare, little opportunity for the sort of well-paid part-time work that exists in European countries, and an expectation to put in exhausting hours on the job.

As much as those other factors may matter, understanding the way that men and women are sorted into different professions, and subsequently paid differently, is crucial for making sense of the gender wage gap. While shepherding girls into STEM and other high-status, male-dominated fields is important, increasing the number of female engineers won’t resolve the problem that those who perform care work are at the bottom of the labor-market totem pole—in large part because the work is associated with women.

If women still dominated computer programming, might the profession be characterized by patience and attention to detail as much as speed and mathematical prowess? If men presided over classrooms, would leadership be emphasized over an affection for children? History suggests that when a job is associated with a single gender, that has a good deal to do with how that job is described—as well as the number on the paycheck that comes with it.

Related Video