Chapter 1

What is Computer Science?

Subsections of What is Computer Science?

Introduction

If you are reading this, you are most likely getting ready to teach a course or unit on computer science. Congratulations!

But before we delve into how to best teach the subject, it is important to first understand what computer science is, and how we learn it. This chapter will address the first of those topics - what computer science actually is as a discipline, and why we want to teach it to our students.

The Discipline

Broadly speaking, Computer Science is:

The branch of knowledge concerned with the construction, programming, operation, and use of computers. (Oxford English Dictionary)

As this definition suggests, Computer Science lies at the intersection of computer hardware, computational techniques, and problem-solving approaches (computational thinking).

It is a relatively young discipline, only emerging as a distinct academic area in the 1950’s and 60’s. Prior to this point, people building and working with computers were drawn from related disciplines: mathematics, engineering, physics, linguistics, and philosophy.

In this chapter, we’ll examine each briefly before discussing how people engage with the field.

Computing Hardware

Computer hardware actually has a long and storied history. Early computers included devices like the Antikythera mechanism , a clockwork device for calculating the positions of the planets built in first or second-century BC in Greece and mechanical calculators incorporating the Leibniz wheel . These early devices can be classified as fixed-program computers, as they can only carry out specific kinds of activities as determined by their structure.

Charles Babbage invented two computing devices, the Difference Engine and the Analytical Engine , both mechanical computers that carried out calculations, that were notable for their size and complexity. The Analytical Engine also marked the first programmable computer design - one that could be easily reconfigured to carry out different kinds of operations. In describing the function of this computer, Ada Lovelace proposed using the computer to compose original music, marking the first time computers were considered for broader use than computations.

Info

Babbage’s Difference Engine No. 2 was designed in 1840, but never built until the modern era. This video discusses that effort spearheaded by the Science Museum of London.

The Z3 and ENIAC were some of the earliest electronic computer devices. They used transistors (switches that could be on or off) to represent data. With only two states, these computers were designed to operate with binary math - 0’s and 1’s. This was a major departure from earlier approaches which operated in the more familiar base 10 (Babbage’s engines represented digits by wheels with 10 faces). Both were programmable: the Z3 read its program from a punched tape, while the ENIAC could be programmed through the use of a plugboard similar to those used by phone operators. The Z3 was considered non-vital by the German military, and was later destroyed in bombing. In contrast, the ENIAC was used to carry out calculations to support American World War II efforts (including carrying out calculations for the atom bomb), and during this time was exclusively programmed by women mathematicians, including Kay McNulty , Betty Jennings , Betty Snyder , Marylyn Wescoff , Fran Bilas , and Ruth Licherman . Their story is discussed in the documentary Top Secret Rosies: The Female “Computers” of WWWII .

Programmers Betty Jean Jennings (left) and Fran Bilas (right) operate the main control panel of ENIAC Programmers Betty Jean Jennings (left) and Fran Bilas (right) operate the main control panel of ENIAC

The next major step forward was stored program computers - computers that had a limited number of instructions they could carry out that were stored in the computer’s memory along with the data on which those programs would operate. These were originally proposed by Alan Turing with his Turing Machine . The physical design on which modern computers are all based was popularized by John von Neumann and is known as the Von Neumann Architecture .

Thus, modern computers share certain characteristics:

  1. They represent all information in a binary form
  2. They can carry out a handful of operations on this binary information
  3. These instructions can be triggered by programs, sequences of these operations
  4. Both the programs and the data they operate on are stored in the memory of the computer

But hardware is only part of the picture. The programs that run on them are just as important. We’ll turn to these next.

Computer Programming

As described in the previous section, modern computers have a limited instruction set that largely concerns moving binary data between memory and CPU registers, and performing mathematical operations on data in those registers. Programs are expressed in ‘assembly code’ or the binary equivalent ‘machine code’ and are essentially sequences of those commands. For example, a program to print the line “Hello World” looks like:

global    _start

          section   .text
_start:   mov       rax, 1                  ; system call for write
          mov       rdi, 1                  ; file handle 1 is stdout
          mov       rsi, message            ; address of string to output
          mov       rdx, 13                 ; number of bytes
          syscall                           ; invoke operating system to do the write
          mov       rax, 60                 ; system call for exit
          xor       rdi, rdi                ; exit code 0
          syscall                           ; invoke operating system to exit

          section   .data
message:  db        "Hello, World", 10      ; note the newline at the end

Writing programs in assembly code is a considerable challenge. Thankfully, visionary programmers like Grace Hopper , Betty Holberton , and Adele Mildred Koss realized they could use programs to write portions of other programs. Grace Hopper took this to the next logical step, writing a program that could translate a more human-friendly language into machine code, known as FLOW-MATIC.

In her later contributions to COBOL, Grace Hopper successfully advocated for expressing program instructions in English. This concept of compiling a human-readable programming language (a higher-order programming language) into machine code is the basis of all modern programming languages: C/C++, Java, Python, JavaScript, C#, etc.

Thus, the same program as above expressed in Python becomes:

print("Hello, World")

Much easier to understand!

Programming languages have continued to evolve, introducing new syntax and organizational approaches intended to make it easier to write programs, reduce errors, improve security, and encourage good programming practices.

One advance in programming languages that is of especial interest to teachers are block-based programming languages like Scratch and Blockly . Instead of typing the program source code, in these languages you assemble the code by connecting graphical blocks. This approach avoids the possibility of an entire family of syntax errors, as the blocks will only snap together in ways that the compiler can interpret. As such, it makes learning to program more approachable for novices.

The same program as above in Scratch is:

Hello World in Scratch Hello World in Scratch

Block-based programming is a great starting place for learning programming and computer science. But writing code by dragging and dropping blocks is also slower than typing, and eventually most programmers will transition to learning a text-based language.

Info

What is in a Name? You may have noticed that the practice of writing programs has multiple names, for example: programming, coding, and hacking. Likewise, programs themselves have multiple names: programs, applications, apps, and software. You may wonder if there is a difference, and what should we call them?

When we write a program using a higher-order programming language, what we have written is the source code. Thus, programming or coding make a lot of sense. The term programming carries a slightly more serious connotation, while coding seems lighter and more fun - which is probably why it has been adopted by the Coding movement which advocates for getting kids involved in programming. Nonetheless, the two terms can (and are) used interchangeably.

Hacking is a bit more problematic. It suggests a more free-form approach to programming, such as ignoring guidelines on how to structure code to be readable to others. Moreover, the term also encompasses the exploitation of computer technology for committing crimes. So it is probably best to avoid using it to refer to the practice of writing programs.

Similarly, a compiled program is an application (app for short). More broadly, an application is a program intended to be used by a person, while programs and software may instead be intended to be run by other programs or directly control a mechanical system (i.e. a robot vacuum cleaner). As programs are stored in memory in a stored-program computer rather than being built into the computer’s physical architecture (the hardware), we can also call them software.

Intellectual Workers

In his landmark address now known as The Mother of All Demos , the computer scientist Douglas Engelbart introduced an early computer operating system developed at SRI. This system and demo introduced ideas like the computer mouse, graphics, hypertext, hyperlinking, collaborative real-time editing, videoconferencing, and screen sharing. These ideas became the basis and inspiration for both the Windows and Macintosh operating systems, as well as the World-Wide Web.

Info

SRI released the full recording of Douglas Engelbart’s demo to YouTube, and the playlist is embedded below. Be warned - the full presentation is 1 hour and 45 minutes (which helps explain the nickname “Mother of all Demos”)

In proposing these technologies, Engelbart suggested that they would support the development of a new class of “Intellectual Worker,” a new class of worker that would use computers to communicate, structure, store, and retrieve data and use computer technology to augment their natural problem-solving capabilities. The introduction of the personal computer in the 1980’s accelerated the development of this class of worker, who primarily relied upon programs built to support various efforts (i.e. a word processor for writing documents, an email client for sending emails). Thus, an intellectual worker was primarily a consumer of programs written by computer scientists.

However, as computing hardware became more available and widely used increasingly intellectual workers began to author their own programs to meet the specific needs of their work. This exploration of programming within specific domains has transformed the way we approach problems in multiple fields:

We have witnessed the influence of computational thinking on other disciplines. For example, machine learning has transformed statistics. Statistical learning is being used for problems on a scale, in terms of both data size and dimension, unimaginable only a few years ago. […] Computer science’s contribution to biology goes beyond the ability to search through vast amounts of sequence data looking for patterns. The hope is that data structures and algorithms – our computational abstractions and methods – can represent the structure of proteins in ways that elucidate their function. Computational biology is changing the way biologists think. Similarly, computational game theory is changing the way economist think; nanocomputing, the way chemists think; and quantum computing, the way physicists think. (Jeanette Wing, 2006, p. 34)

In other words, intellectual workers are increasingly using the tools of computer science, not just the products. This realization has driven the call for teaching computer science in K-12 education - as today’s students will increasingly need to be able to use computational thinking and programming in their future work, even if they aren’t going to be a computer scientist.

Computational Thinking

The term “Computational Thinking” has recently caught on as a way to describe how we can approach problem-solving using computation. While there is some debate on exactly what constitutes computational thinking, I like the definition:

Computational thinking is the thought processes involved in formulating problems and their solutions so that the solutions are represented in a form that can effectively be carried out by an information-processing agent.

In other words, computational thinking is about reformulating problems. You’ve already done this in your own education. Remember word problems like:

Two trains leave a station, one a passenger train traveling east at 8 miles per hour, and one a freight train traveling west at 12 miles per hour. The two stations are 521 miles apart. Assuming the two trains are traveling on parallel tracks, how much time will elapse before they pass each other?

To solve this, you probably would reformat it into algebraic formulas:

$$ position_1(t_n) = velocity_1 * t_n $$ $$ position_2(t_n) = velocity_2 * t_n $$ $$ distance(t_n) = position_1(t_n) + position_2(t_n) $$

After which you could combine the formulas:

$$ distance(t_n) = velocity_1 * t_n + velocity_2 * t_n $$

Substitute known values:

$$ 560 = 8 * t_n + 12 * t_n $$

And solve for $t_n$ :

$$ 560 = 20 * t_n $$ $$ 560/20 = t_n $$ $$ t_n = 28 $$

In this example, you are the information-processing agent. You reformulated the problem into a form you knew how to solve (algebraic expressions).

But when we talk about computational thinking, the information-processing agent we are typically referring to is a digital computer. We need to structure the problem in a form it can process - a program. Thus, computational thinking is really about taking a real-world problems and reformulating them as programs that solve them.

Note that we need two separate but related skills to do this - we must be able to come up with an approach to find a solution, and we must know enough programming to express it.

Summary

In this chapter we discussed what computer science is as a discipline and explored a bit of its history and foundations. We also discussed computational thinking, a problem-solving approach that leverages the tools of computer science - computers and programs - to solve problems. We briefly covered how computational thinking is transforming how people solve problems in their disciplines, which helps explain why it is increasingly necessary to teach it to our students.

In the next chapter, we will look at the science behind how people actually learn computer science and computational thinking.