My path to a career in software engineering should have been simple. I grew up in Silicon Valley, the child of two software engineers with computer science PhDs. I went to high school in Mountain View—the land of Google. Later, I went to college at Stanford University, where our university president was a computer scientist who had made a fortune in microprocessors. During the summers, I interned at Facebook and Google.

But even though I was completely immersed in tech culture, I had trouble envisioning a career in software engineering for myself. The issue wasn’t a lack of interest or ability. It was that the sexism I encountered, both in school and in the workplace, had me convinced that I wasn’t just good enough to make it in tech.

At Stanford, I took two introductory computer science classes. I soon became convinced that I was much too behind my male classmates to ever catch up. I was surrounded by men who’d breezily skipped prerequisite courses. As freshmen, they’d signed up for classes that I was intimidated to take even as a sophomore. They casually mentioned software engineering internships they had completed back in high school, and declared they were unfazed by any of the challenges professors might throw our way.

My classmates bragged about finishing assignments in three hours. I told myself that they were quantifiably five times better me.

I remember the first “weeder” computer science course I took–meant to discourage the unworthy from pursuing the major. My classmates bragged about finishing assignments in three hours. Listening to them chat, I felt mortified: the same work had taken me 15 hours of anguish at the keyboard to complete. They are quantifiably five times better than I am, I told myself.

Lots of my classmates talked about how the course really wasn’t as bad as everyone made it out to be. I disagreed. By the end of the quarter, their unflappable self-assurance had me convinced that I was meant to be rooted out. I decided not to major in computer science.

Like many a woman before me, I had run smack into the confidence gap. Researchers have shown that women consistently rate their abilities more negatively than men, while men give themselves inflated marks. In the face of my classmates’ bluster, I didn’t consider the idea that they might be bluffing. Instead I assumed the problem was me.

My status as one of the few women in computer science classes was always a subject of discussion.

It was no wonder that I felt like I didn’t belong: my status as one of the few women in computer science classes was always a subject of discussion. A few of my friends joked that as a girl, I could at least get more attention from the section leaders. They told me about a couple of other girls in my year who had had great success flirting shamelessly with the teaching staff—nerdy awkward guys unaccustomed to female attention, and therefore overly eager to be helpful in office hours. I wondered if the implication was that I ought to do the same—or that in their eyes, I already was.

The jokes and gossip made me uncomfortable, but I laughed along. I took for granted the offhanded way we all spoke about women in the field. I didn’t question the casual sexism of the assumption that women would need to use their feminine wiles to finagle assistance in our coursework. Instead I just incorporated these messages into my larger sense that I was out of place and not quite good enough.

Then something happened that helped alert me to the gender dynamics at work. A couple months after I had completed that “weeder” class, my professor asked me to be a teaching assistant the next time the course was offered.

I thought for sure that he had made a mistake. My impulse was to write back in total disbelief. Maybe he had confused me with someone else?

When my professor asked me to be a teaching assistant, I thought for sure that he had made a mistake.

Instead I sent an email saying mildly, “I’m a little doubtful of my qualifications to be a TA.” But my professor insisted, and I took on the role.

The experience was a revelation. As a TA who graded assignments and helped students during office hours, I could see things from a very different vantage point. I had always taken my classmates’ word for it that they were coding masterminds. Now I could calibrate students’ bragging to their actual performance. I finally acknowledged that I might have underestimated my own abilities. And I contemplated the irony of the fact that I was performing solidly as a teaching assistant for the course that had convinced me I wasn’t cut out for the major only two quarters prior.

That wasn’t the last time I felt discouraged from pursuing a career in software engineering. My internships at Google and Facebook were both incredible opportunities. I could hardly believe my luck to be on the inside of two of the most glamorous and prestigious companies in Silicon Valley, picture badge clipped to my jeans pocket.

My colleagues complimented me on the way I looked, not the work I produced.

But the office environment turned out to be little better than the classroom. I could never shake the feeling of being petted as an adorably confused young intern. I felt as if I was welcomed because I was cute to keep around, not because there was any expectation of my doing useful, good work. My fellow interns and full-time coworkers were first friendly, then flirty. They floated awkward pick-up lines and complimented me on the way I looked, not the work I produced. One offered to give me a massage “because I looked stressed.” Another tried to get me to watch a movie with him in a dark room with the door locked and blinds closed. Later, he gave me a custom-made t-shirt with his name emblazoned across the front.

Meanwhile, I had to scavenge for scraps of work. The big project I had been promised for my internship was given to someone else.

Most girls and women trying to make progress in tech face these same kinds of obstacles. It begins early, with socialization that keeps girls in the pink aisle of the toy store and steers them away from chemistry sets and Legos–toys that can spur an interest in science and engineering. Both parents and teachers may unintentionally discourage girls from pursuing math and science–and in a more general way, from being brave and taking the risks to explore unknowns in the world. Yet researchers have shown that having the attitude of a creative and fearless “intrepid explorer” is crucial to one’s success in computer science and technology.

For those girls who do somehow manage to make into the computer science classroom in college, the dangers of imposter syndrome are strong. Women all too frequently report fearing that they are frauds who don’t deserve their jobs. They tend to have an irrational ability to dismiss their own success, attributing it to factors like luck, timing, or external help, and dismissing their own role in achieving it. This tendency is often reinforced by environmental cues–whether it’s a classmate suggesting that “cute girls” receive more help from TAs, or a boss giving a male engineer credit for a joint project while ignoring the contributions of his female colleague.

Ultimately, Silicon Valley’s insatiable demand for software engineers still drew me into the field. I’m glad to be here now and working at Pinterest. But I often think back to the headwinds that sought to force me off-track, or at least slow me down. I had so many advantages–and I still barely made it. Too many girls and women cannot say the same.