Sorry to BUG you: Grace Hopper

Programs don’t always do what they are supposed to. A mistake in a program is called a bug. The first computer bug really was a minibeast. It was a moth found trapped in an early computer. Grace Hopper, one of the very first programmers, told everyone about the ‘bug’. This made sure that everyone used the word bug from then on. Grace Hopper is famous for more than just the word ‘bug’, though. She had a brilliant idea that helps programmers avoid bugs.

The programs for those early computers all had to be written using their own machine instructions. Programming in these basic instructions is like giving someone directions to the station, but by telling them exactly where to put their foot for every step. Worse still, a program written for one computer wouldn’t work for another.

Have an idea!
Grace’s idea was that you could write programs using English words where each command stood for lots of machine instructions – like only saying when to turn, in those directions to the station, rather than giving every step. We call a language like this a high-level programming language. Most programs are now written in high level languages.

Make it work
Grace didn’t just have the idea, she made it work too. She designed a high-level language. She also needed a way to convert a program written in her language into those machine instructions so the computer could follow them. Grace had the answer for that too – a compiler. A compiler is just another computer program, but one that translates written programs into machine instructions. Grace wrote the first ever compiler.
She also realised that if she wrote a compiler for different machines, her programs would then work on any machine. These ideas led to the first widely used programming language, called COBOL, and Grace wrote the compiler for that too.

Fewer bugs
Her ideas made programming much easier, making bugs less likely. Really big programs were now possible and once written could be used on lots of different
machines. The computing revolution was up and running!

Fun to do: List bugs, plant bugs

If you have written any programs yourself, make a list of the bugs you have found when debugging them. Are there some bugs that you often see? Can you make some buggy code for a friend to debug?

More history