Chapter 1
Computer Hardware and Software
1.1 Brief History of Computers ............................................................. 3
1.2 Hardware Components of a Computer ................................................. 3
1.3 Binary Representation of Numbers ..................................................... 6
1.4 Software Creation and Types of Software .............................................. 6
1.5 Type of Programming Languages ...................................................... 7
1.6 Brief History of Computer Games ...................................................... 8
1.7 Summary ................................................................................ 9
1.8 Important Points ....................................................................... 10
1.9 Exercises ................................................................................ 10
This chapter introduces the basic components of a computer: its hardware and software. Af-
ter all, this is a computer programming textbook and we need to have a basic understanding
of how the computer works before we can start developing software for it. For completeness,
some historical information about computers and computer games is also included in the
chapter.
1.1 Brief History of Computers
Computers are electronic devices that can perform calculations. The first electronic
digital computer was built by physics professor John Atanasoff and his graduate student
Clifford Berry in 1937. The computer could not be programmed and could be used only to
solve linear equations. Six years later, in 1943, the first programmable electronic computer
was built by Tommy Flowers; see Figure 1.1.
As you can see in the picture, the first computers took a lot of space. Different compo-
nents, such as secondary storage and main memory, were in separate racks. Early computers
could easily fill a present-day classroom. Colloquial expressions such as: “I will go to check
on the memory” were common in those days. Even the term “bug”, which is commonly
used to describe a software error, derives from the days when actual rodents were roaming
around the different components of a computer. As time progressed, computers became
smaller and cheaper. The personal computer was introduced in the late 1970s and early
1980s by the likes of Hewlett Packard, Apple, and IBM.
1.2 Hardware Components of a Computer
The brain of a computer is the Central Processing Unit (CPU); see Figure 1.2 . It is a
device that can perform simple calculations. These include addition, deletion, subtraction,
3
4 Learning Java through Games
FIGURE 1.1: A Colossus Mark 2 computer. Artwork created by United Kingdom Gov-
ernment.
FIGURE 1.2: An Intel 80486DX2 CPU from above. Photographed by Andrew Dunn. The
picture is licensed under the Creative Commons Attribution-Share Alike 2.0 Generic license.
and multiplication. The speed of a CPU is measured in hertz, which is a measure of frequency
in cycles per second. In one cycle, the CPU can perform one instruction. Typical CPU
speeds of modern computers are around 2 GHz, which corresponds to 2 gigahertz, or 2
billion instructions per second. The actual data on which the operations are performed is
stored in main memory; see Figure 1.3. The main memory is where both the programs and
the data are stored.
The main memory contains both the application data and the commands that manip-
ulate the data. The commands from the main memory are loaded on the CPU. The CPU
then reads data from main memory, performs the operation that is requested, and saves the
result back into main memory. Therefore, all a computer can do is to move data from one
spot to another in main memory and perform arithmetic computations.
The main memory of a computer consists of a sequence of cells, where every cell can
take one of two states: 0 or 1. The different values are usually represented by different
voltage. For example, 0.8 volts or below may denote 0, while 2.2 volts or above can denote
the number 1. In computer science, this single cell is referred to as a bit. Table 1.1 shows
common units for measuring the size of memory (i.e., number of bits).
In modern computers, the main memory of a computer is typically between 1 and 16
GBs, while the hard disk can typically store anywhere between 256 GB and 1 TB. Moore’s
law is the observation that over the history of computing hardware, the number of transistors

Get Learning Java Through Games now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.