Chapter 1 Background - KCD Academic Home Page

advertisement
Chapter 1
Intro to Programming
Go
Section 1 - The History of Computers
Go
Section 2 - Binary Representation of Information
Go
Section 3 - Programming Languages
Go
Section 4 - The Software Development Process
Go
Section 5 - Introduction to Object Oriented
Go
Programming
Section 6 - ACM Code of Ethics and Copyright Laws
Section 1
The History of Computers
Generation 1: Pre-Electronic Age Computers
Generation 2: Computers that used Mechanical Relays
Generation 3: Computers that used Vacuum Tubes
Generation 4: Computers that used Transistors
Generation 5: Computers that had Integrated Circuits
Generation 6: Computers that had Hard Drives
2
Generation 1
The Pre-Electronic Age of Computers
2000 B.C. to 1930 A.D.
3
Generation 1: Abacus & Difference Engines
These computers used no electricity and were either powered manually or by
some source other than electricity. Two examples are the abacus and
difference engines.
The abacus has been used by various
cultures since around 2000 B.C.
Pictured here is a Chinese abacus.
A Difference Engine is an automatic,
mechanical calculator designed to
tabulate polynomial functions. Both
logarithmic and trigonometric functions
can be approximated by polynomials, so
a difference engine can compute many
useful sets of numbers. Pictured here is
Charles Babbage’s Difference Engine.
4
Generation 1: Charles Babbage’s Analytical Engine
Charles Babbage proposed the
first difference engine in 1822. He
is recognized as the Father of
modern computing. While building
it, he realized that a much more
general design, the Analytical
Engine, was possible. The input for
it (programs and data) was to be
provided to the machine by
punched cards, a method being
used at the time to direct
mechanical looms such as the
Jacquard loom.
5
Generation 1: Charles Babbage’s Analytical Engine
The steam powered version of the Analytical Engine was never built,
but based on Babbage's original plans, the London Science Museum
constructed a working Difference Engine No. 2 from 1989 to 1991, under
Doron Swade, the then Curator of Computing. The project was a
celebration of the 200th anniversary of Babbage's birth in 1791.
6
Generation 1: The First Programmer - Ada Lovelace
While Charles Babbage was
working on his new Analytical Engine,
he met Ada Byron Lovelace. She
was the daughter of famed English
poet Lord Byron. Babbage
suggested that she write notes about
the design of the Analytical Engine,
because of her skill of translating
things in a meaningful and practical
way.
Ada suggested to Babbage a plan
for how the engine might calculate
Bernoulli numbers. This plan, is now
regarded as “the first computer
program.”
A software language developed by
the U.S. Department of Defense was
named "Ada" in her honor in 1979.
To read a short biography of Ada Lovelace’s life, visit:
http://www.agnesscott.edu/lriddle/women/love.htm
7
Generation 2
Computers with Electromechanical Relays
The 1930s and 1940s
8
Generation 2: Relays Rather Than Gears
When computers used
electricity for the first time, the
electrical circuits within them
contained electromechanical
relays that acted as switches.
Here is one example of a relay.
These relays allowed electricity to either flow or not to flow,
creating an on or off condition that we now think of as a 1 or 0.
Because everything related to the operation of a computer is based
on the “off” and “on” state of circuits, a knowledge of binary numbers
(base 2 numbers) is important for any programmer or computer
scientist.
9
Generation 2: Electromechanical Relays
Here is another example of a simple mechanical relay. Relays are
most simply a combination of switches and a coil of wires. When
electricity passes through the coil, a magnetic field is created that
makes the main contact move.
other contacts
mechanically attached
to main contact
main contact
wrapped coils of
wires in green case
The main contact is connected mechanically to other contacts that
make contact with other contacts and complete a circuit or circuits so
that electricity flows in them.
Click here to learn more about simple mechanical relays:
http://www.kpsec.freeuk.com/components/relay.htm
10
Generation 2: Differential Analyser
Here is a picture of one of the earliest electromechanical relay computers
called the Cambridge differential analyser. It was put in use in 1938. There
are no vacuum tubes or transistors in this computer, only simple mechanical
relays.
A differential analyser is a mechanical analogue computer designed to
solve differential equations by integration (a topic of calculus), using wheeland-disc mechanisms to perform the integration. It was one of the first
advanced computing devices used.
11
Generation 2: Mark 1 Computer
Here is a diagram of one of the earliest electromechanical relay computers
called the Mark 1 and a picture of its associated gun director machine with
radar. The Mark 1 was essentially an electromechanical analog computer
that was electrically linked to the gun turrets through the Mark 37 gun
director used on Navy ships during World War II from 1941 to 1945.
Sketch of the Mark 1 Computer
The Mark 37 Gun
Director with radar
mounted on top
12
Generation 3
Computers with Vacuum Tubes
The 1940s & 1950s
13
Generation 3: Invention of the Vacuum Tube
In 1906, the eccentric American inventor Lee De
Forest developed a triode in a vacuum tube. It was a
device that could amplify signals. It was first used to
amplify telephone and telegraph signals over lines
and then was used in the first wireless radios that
were invented shortly thereafter.
Radio communication was only first used by the
U.S. Navy during World War I from 1914 to 1918.
The first AM Radio Station, KDKA in Pittsburg, went
on the air in 1920. In Kentucky, the first broadcast of
WHAS radio 840 AM was on July 18, 1922. On May
16, 1925, the first live broadcast of the Kentucky
Derby was originated by WHAS.
Vacuum tubes were not used in computers until
the 1940s.
For more about the invention of the vacuum tube visit:
http://www.pbs.org/transistor/album1/index.html
14
Generation 3: How Vacuum Tubes Work
Digital electronic computers like
ENIAC, were made up mostly of
vacuum tubes. Vacuum tubes
operate similarly to relays in that
when you apply a voltage to the
anode and cathode of the tube, then
a current flows through the vacuum
tube. So the vacuum tube is acting
like a switch. When no voltage was
applied, the switch was open and no
current flowed in the circuit. When a
voltage was applied, the switch was
closed and current flowed through
the circuit.
15
Generation 3: ENIAC
ENIAC, one of world’s first digital electronic computers, stands for
Electronic Numerical Integrator And Computer. It used many vacuum tubes.
16
Generation 3: Deficiencies of Vacuum Tubes
ENIAC used many glass vacuum tubes that put
off a tremendous amount of heat.
Vacuum tubes were very important electronic
components that were used before transistors and
integrated circuit chips were invented.
Vacuum tubes would burn out like light bulbs and
would have to be replaced often.
The circuit board block at the left is one of
hundreds of blocks that held the 4000
vacuum tubes for IBM's Model 701, It was
one of the first computers intended for
scientific work.
Here are some links about vacuum tubes:
http://mason.gmu.edu/~montecin/vacuum_tube.html
http://nobelprize.org/physics/educational/integrated_circuit/history/
17
Generation 3: The Need for a New Component
Computer designers realized right away that there was a need
to come up with a new electronic component that …
• didn’t put off so much heat
• didn’t burn out as often
• and was much smaller in size
Comparative size of a vacuum tube and its
replacement component called the transistor.
18
Generation 3: Programming Computers with Punch Cards
Punch cards were first
invented by Herman Hollerith
prior to the 1890 Census to
be used in tabulating the
population of the U.S.
However, at that point, they
were used only with
mechanical machines for the
purpose of counting.
IBM used punch cards to send the lines of code of a program to a
computer so it could be run. This continued up into the 1970s. Each
line of code in a program was written on a separate card. In the 1950s,
IBM sold its first business computer. Its awesome computational
power was a mere 1/2000 of the typical 2-gigahertz Pentium PC today.
19
Generation 3: Programming Computers with Punch Cards
During this time, the programming
languages Fortran and COBOL were
popular. Fortran was used to write
programs by mathematicians and scientists
who wished to make calculations. COBOL
was used by programmers who wanted to
write programs for the business world.
Programmers would type out each line of code on a machine that had a
keyboard that could then punch the holes for that line of code into a card.
After all lines of code were punched into a set of cards, the cards were
placed in the order that the lines of code needed to be executed in a
program. Getting the cards out of order was disastrous. The cards were
then fed into a card reader so they could be read by a large main frame
computer like an IBM 360 computer. When the program read the computer,
its output would be printed on large green sheets of pin-hole fed paper.
20
Generation 3: Programming using Teletype Machines
In the 1960s, the computer world still
revolved around large main frame
computers and no personal computers
existed.
An option to using punch cars was to sit
at a remote keyboard called a teletype like
this one and type your code or instructions
for a program. The instructions were then
sent to the mainframe computer at another
location by telephone lines.
So if a company couldn’t afford to have
their own computer, then they rented time
on someone else’s mainframe. This was
called Time-sharing.
During this time, the first computers
using transistors were being designed once
they began being produced in 1959.
21
Generation 4
Computers with Transistors
The 1960s
22
Generation 4: The Invention of the Transistor
The invention of the transistor at Bell Laboratories on December 16,
1947 by John Bardeen (left) and Walter Brattain (right), and William
Shockley (seated at Brattain's laboratory bench).
The first silicon transistor was produced by Texas Instruments in
1954 after seven years of development. This was perhaps the most
important electronics event of the 20th century, as it later made
possible the integrated circuit and microprocessor that are the basis of
modern electronics.
23
Generation 4: Transistors in Radios
One of the first uses of transistors was in
transistor radios. For the first time, you
could take a radio with you and listen to your
favorite radio station. Most people listened to
music from radio stations because no ipods or
portable tape players existed yet. Following
their development in 1954, transistor radios
became the most popular electronic
communication device in history, with billions
manufactured during the 1960s and 1970s. In
the 1970s their popularity declined as other
portable media players such as boom boxes
and portable cassette players took over.
Source: http://en.wikipedia.org/wiki/Transistor_radio
24
Generation 5
Computers with Integrated Circuits
The 1960s and 1970s
25
Generation 5: The Need for Smaller Components
As transistors became prevalent in radios, computers, and
phones they still weren’t small enough. There was a limit on how
small you could make each transistor, since it had to be connected
to wires, resistors, and capacitors in a circuit. The transistors were
already at the limit of what steady hands and tiny tweezers could
handle.
So, scientists wanted to make a whole circuit -- the transistors,
the wires, and everything else they needed and place them in one
single electronic unit. If they could create a miniature circuit in just
one step, all the parts could be made much smaller.
26
Generation 5: The Invention of the Integrated Circuit
Here is a picture of one of the first successful integrated circuits. It
is one large slice of silicon created in such a way that it contains
numerous electrical components.
27
Generation 5: Invention of the Integrated Circuit
Transistors began to be used in large
mainframe computers. However,
personal computers were not invented
until the late 1970s, because they still
weren’t practical because of size
limitations. A computer needed many
transistors, resistors, and capacitors in
numerous different circuits that were all
linked together on one circuit board. So
the circuit board had to be pretty large or
sometimes numerous circuit boards
were needed to make one computer.
It would take the invention of the
integrated circuit to make PCs possible,
because it allowed the creation of much
smaller circuits that contained all
electrical components on one slice of
silicon.
An integrated circuit with
numerous transistors and
other components. It is the
job of electrical engineers to
design different circuits to
accomplish a particular task.
28
Generation 5: The Inventors of the Integrated Circuit
The invention of the integrated circuit came simultaneously to two
different people in 1958, when they realized that not just transistors
but whole circuits could be made out of a chip of silicon.
The two persons were …
Jack Kilby of Texas Instruments
Robert Noyce of Fairchild Semiconductor
29
Generation 5: The First Personal Computers
In the 1970s, the first PCs (personal computers)
appeared. They utilized integrated circuits that
were made up of many transistors.
Many of the earliest PCs did not have a hard
drive so the operating system could not be stored
on the computer. Instead, computers were booted
An Apple IIe with
joy stick
from floppy disks that contained the operating
system and if you wanted to save any work, you
had to have a second floppy drive to save data to.
Two of the first PCs were the Apple IIe and the
An IBM PS1
IBM PS1.
30
Generation 6
Computers With Hard Drives
The 1980s to Present
31
Generation 6: The IBM PS 1
During this time, networking
of computers was first
implemented.
A number of IBM or Apple
computers could be daisychained with telephone wires
and connected to a printer. This
was a big step!
One of the first IBM PS1 computers.
32
Generation 6: The Apple Macintosh LC
The Macintosh LC II
Color computer.
The original Macintosh LC, released in 1990, was the first
affordable color Macintosh and contained a 40 Megabyte hard drive
with 4MB of RAM. This was incredibly small compared to the 200 to
500 Gigabyte hard drives placed in computers today that have 4GB of
RAM. Due to its affordability and Apple II compatibility the LC was
adopted primarily in the education and home markets.
33
Generation 6: The Birth of Networking
In the 1960s, computer scientists began to network
computers with other devices like printers and teletype input
terminals.
Research was under way to create appropriate modems
that would transfer computer signals long distance over
telephone lines from one computer to another.
Experimentation of these long distance transmissions
between numerous universities in the western part of the
United States was taking place.
34
Generation 6: The Birth of Networking
In 1969, four universities:
UCLA (University of California at Los Angeles)
SRI (Stanford Research Institute)
UCSB (University of California at Santa Barbara)
University of Utah
made up the first 4 node remote network from which evolved the
internet. Handwritten logs from UCLA show the first host-to-host
connection, from UCLA to SRI, was made on October 29, 1969.
Source: http://en.wikipedia.org/wiki/History_of_the_Internet
For more information on this you can also see:
http://www.computerhistory.org/internet_history/
http://www.netvalley.com/archives/mirrors/davemarsh-timeline-1.htm
35
Generation 6: The Birth of the Internet
In the1980s, networking started to advance and the age of
the internet was officially born in 1989, even though the
technical infrastructure of it existed as a computer network that
the US Military and developed in the 1960s. Computers had
hard drives for the first time.
The World-Wide Web began in March 1989 at CERN in
Geneva, Switzerland. (CERN was originally named after its
founding body the "Conseil Europeen pour la Recherche
Nucleaire," (Europena Counsil for Nuclear Research) and is
now called "European Laboratory for Particle Physics”.
The internet wasn’t available to the general public until the
1990s as businesses and schools developed computer
networks.
36
Generation 6: The Birth of the Internet
Tim Berners-Lee was a member of CERN and invented the
networked hypertext system called the World Wide Web. With this
system, graphics and text could be displayed through the use of
HTML code written for a web page.
Over the years, HTML code has been continuously upgraded so
that web pages could present many different forms of media including
sounds, movies, interactive games, and on-line purchasing.
The HTML Applet tag (command) allows Java programs to be
loaded into web pages.
HTML is an acronymn for HyperText Markup Language.
Click here for more information about Tim Berners- Lee inventing
the hypertext system:
http://www.historyoftheinternet.com/chap6.html
37
Generation 6: The Explosion of PCs
In the 1990s, there was an explosion of
the number of personal computers in
the US with many homes having a
computer for the first time.
There were many more models of
computers to choose from and
computers now had …
bigger hard drives
more RAM memory
modems to allow connecting to the
internet.
38
Generation 6: Ubiquitous Computing
Ubiquitous computing is now very common.
Ubiquitous means anywhere - anytime.
Cell phones and laptop computers have led the way for ubiquitous
computing by virtue of the fact that they can we used virtually
anywhere if they are within range of a cell phone tower. Now their
functionality includes email, internet, and a host of other features.
39
Generation 6: Ubiquitous Computing
Ubiquitous computing also includes the use of digital cameras,
portable music players, and PDAs, even though they are not in a
strict sense a computer.
Even though a computer may be necessary to transfer data from or
to them, many of these will become wireless before too long and will
essentially be performing the work that a computer performs.
For a comprehensive time line of the History of Computers please go
to …
http://mason.gmu.edu/~montecin/computer-hist-web.htm
40
Generation 6: Progression of Computers
In review, computers progressed in the following way:
1.
Large mainframe computers (like ENIAC) were used, where patch cords
or punch cards enabled the computer to be programmed.
2.
Computer terminals that had a keyboard but no other computer parts that
communicated with mainframe computers by telephone lines from a
remote location. A user typed instructions on the terminal and they were
sent to the mainframe and then output was printed out back at the
terminal.
3.
Personal computers that had hard drives that contained operating
system software and application software, where the user was able to
perform work on the computer without communicating with another
computer.
4.
Networked computers - personal computers attached to a network that
allowed them additional flexibility like connecting to a server, the internet
or network printers.
41
Generation 6: Progression of Electronics
In review, electronic components in computers progressed as follows:
1.
Computers first contained electromechanical relays. These relays
controlled whether electricity was flowing through a circuit or not.
2.
Next, computers contained vacuum tubes. Vacuum tubes controlled
whether electricity was flowing through a circuit or not, but also the
electricity in a circuit could be amplified. The inherit problem with
vacuum tubes was that they put out a lot of heat and burned out,
therefore they had to be replaced often.
3.
With the invention of the transistor, vacuum tubes became obsolete.
Transistors performed the same function as vacuum tubes, but their size
was much smaller, they didn’t put out very much heat and they didn’t
burn out as often.
4.
Integrated circuits were invented because of the need to place thousands
of transistors in circuits. An integrated circuit allowed tiny transistors (that
didn’t look like the original ones) to be etched onto a printed circuit board
with other components like resistors and capacitors. Integrated Circuits
were the foundation of today’s microcomputer chips.
42
Generation 6: Hardware vs. Software
In talking about the history of computers, one thing may not be clear
… the difference between hardware and software.
•
Hardware: Physical devices that you see on your desktop,
including the computer case, the power supply, keyboard, mouse,
modem, ethernet and USB ports, screen, RAM memory, CD/DVD
drive, and hard drive.
•
Software: Programs that give the hardware useful functionality:
1.
2.
System (Operating System) software (Windows 7 or Mac OS X)
Application software (Word, PowerPoint, Excel or Eclipse).
43
Section 2
The Binary Representation
of Numbers and Characters
44
Sect 2: Bits and Bytes
•
Bit (binary digit): Smallest unit of information processed by a
computer
•
A bit can hold either a single 0 or 1.
•
Byte: 8 adjacent bits or memory cells located in RAM memory
•
Capacity of computer memory and storage devices usually
expressed in bytes. For example:
4 Gigabytes of RAM
2 Terabyte hard drive
45
Sect 2: Binary Representation of Information
Computer memory stores patterns of electronic signals as 1s and
•
0s.
•
There are two states for an electronic signal:
1.
On - represented by a 1
2.
Off - represented by a 0
Computer scientists use these bases in relation to various
•
computer operations:
•
binary (base 2)
•
octal (base 8)
•
hexadecimal (base 16)
46
Sect 2: Bits and Bytes
Unit of Bytes
Number of Bytes
Representative Storage
Kilobyte
1 thousand bytes
A small file
Megabyte
1 million bytes
Large files, CDs
Gigabyte
1 billion bytes
DVDs, RAM, and hard disks
Terabyte
1 trillion bytes
File Servers
Petabyte
1 quatrillion bytes
Large Server Arrays
Exabyte
1 quintillion bytes
???
Some commonly used quantities of information storage
from smallest to largest.
47
Sect 2: 8 Bits Make a Byte
A computer stores all information as a series of 1s and 0s. That
means that all letters, words, and sentences and all integers and
floating-point numbers must be converted to 1s and 0s so that they
can be stored or manipulated.
In most computer systems, 8 bits make a byte. Remember … a bit is
a single “cell” of memory that can hold either a “0” or a “1”. You may
know that the base-2 number system (binary) has only 1s and 0s in it.
So a computer works with a binary number system. Here is how we
could diagrammatically represent one byte of computer memory:
8th bit
7th bit
6th bit
5th bit
4th bit
3rd bit
2nd bit
1st bit
1
0
1
0
1
0
1
0
The next slide shows why we order the bits from right to left
instead of left to right.
48
Sect 2: Base-2 Numbers (Binary)
8th bit
7th bit
6th bit
5th bit
4th bit
3rd bit
2nd bit
1st bit
1
1
0
1
1
0
0
1
25
24
23
22
21
27
26
20
Each bit represents a power of 2 that allows us to properly view a binary
number. The above base-2 number 110110012 is equal to the base-10 number
217. Note the power of 2 that represents each bit. We can calculate the
equivalent base-10 number by using scientific notation …
1 x 27 + 1 x 26 + 0 x 25 + 1 x 24 + 1 x 23 + 0 x 22 + 0 x 21 + 1 x 20
128 +
64
+ 0
+ 16
+
8
+
0
+
0
+
1 = 217
Some computers may use a 4 byte “word”. This is the same as saying a group
of 4 bytes. Of course every byte is 8 bits, so a 4 byte word represents 32 bits.
An 8 byte word, represents 64 bits. Most computers are now 64 bit
processors.
49
Sect 2: Converting From Base 2 to Base 10
The base-2 number 100112 can easily be converted to 1910 base-10
using scientific notation.
100112 = (1 * 24) + (0 * 23) + (0 * 22) + (1 * 21) + (1 * 20)
=
16
+
0
+
0
+
2
+
1 = 19
And the number 1110102 is equal to 5810 since …
1110102 = (1 * 25) + (1 * 24) + (1 * 23) + (0 * 22) + (1 * 21) + (0 * 20)
=
32
+
16
+
8
+
0
+
2
+
0
= 58
50
Sect 2: Converting From Base 10 to Base 2
We can successively divide any base 10 number by two and record the
remainders to determine the equivalent base 2 number.
1910 is equal to 100112
5810 is equal to 1110102
19 divided by 2 gives 9 with a remainder of 1. Notice carefully where the 9 and 1
are recorded. You continue to divide by 2 until you get 0. This tells you to stop.
51
Sect 2: Counting in Binary
Base 10 Number
Equivalent Base 2 Number
0
0000 0000
1
0000 0001
2
0000 0010
3
0000 0011
4
0000 0100
5
0000 0101
6
0000 0110
7
0000 0111
8
0000 1000
9
0000 1001
10
0000 1010
11
0000 1011
12
0000 1100
13
0000 1101
14
0000 1110
15
0000 1111
16
0001 0000
52
Sect 2: Base 16 Hexadecimal Numbers
Base 16 numbers are called hexadecimal numbers. Here is how
you count in base 16:
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
So ….
A represents 10
B represents 11
C represents 12
D represents 13
E represents 14
F represents 15
53
Sect 2: Base-16 Hexadecimal Numbers
8th bit
7th bit
6th bit
5th bit
4th bit
3rd bit
2nd bit
1st bit
0
0
0
0
1
4
6
F
167
166
165
164
163
162
161
160
Each bit represents a power of 16 that allows us to properly view a
hexadecimal number. The above base-16 number 146F16 is equal to
the base-10 number 523110. Note the power of 16 that represents each
bit. We can calculate the equivalent base-10 number by using scientific
notation …
0 x 167 + 0 x 166 + 0 x 165 + 0 x 164 + 1 x 163 + 4 x 162 + 6 x 161 + 15 x 160
0
+
0
+
0
+
0
+ 4,096 + 1,024 +
96
+
15
= 5,231
54
Sect 2: Converting From Base 16 to Base 10
The base 16 number 146F16 can easily be converted to 523110
base-10 also using scientific notation.
146F16 = (1 * 163) + (4 * 162) + (6 * 161) + (15 * 160)
= 4,096 + 1024 +
96
+
15 = 5231
Similarly, the base 16 number 3B9C16 can be converted to
15,26010 base-10 using the same process.
3B9C16 = (3 * 163) + (11 * 162) + (9 * 161) + (12 * 160)
= 12288 + 2816 + 144 + 12 = 15260
55
Section 2: Converting From Base 10 to Base 16
We can successively divide any base 10 number by 16 and record the
remainders to determine the equivalent hexadecimal number.
5231 divided by 16 gives 326 with a remainder of .9375. Multiplying .9375
by 16 gives 15. The hexadecimal digit for 15 is F. Note when using a
calculator, the decimal portion of the number is multiplied by 16 to find the
whole number remainder.
Try converting 15,26010 and see if you get 3B9C16.
56
Sect 2: The ASCII and Unicode Encoding
In the United States, computers have used the ASCII encoding
scheme (American Standard Code for Information Interchange),
where each number or character is represented as 1 byte, a pattern
of 8 bits (Eight 1s or 0s). This allows us to represent up to 256
characters, since 28 = 256.
However, Java is an international language and uses an expanded
Unicode encoding scheme:
–
2 bytes (16 bits) are used to represent any character
–
This allows us to represent 65,536 different character
combinations since 65,536 = 216 and all the characters from
different languages in the world can be represented!
57
Sect 2: The ASCII Encoding Scheme
The letter “A” is
represented by ASCII
Code number 65.
Small “a” is represented by
ASCII Code number 97.
The Hex column
represents the equivalent
hexadecimal number.
58
Sect 2: Character Digit Representations
As you have seen from the ASCII Code Chart, numbers and alphabetical characters
are represented by base 10 numbers that have an equivalent hexadecimal and binary
number. The digits 0 - 9 not only represent numbers but they also represent
characters as in the password “Bearcat2013”, so the digits aren’t converted to binary,
but the associated ASCII number is converted to binary.
Keyboard Character
ASCII Number
Binary Representation
0
48
0011 0000
1
49
0011 0001
2
50
0011 0010
3
51
0011 0011
4
52
0011 0100
5
53
0011 0101
6
54
0011 0110
7
55
0011 0111
8
56
0011 1000
9
57
0011 1001
59
Sect 2: Upper Case Letter Representations
Keyboard Character
ASCII Number
Binary Representation
A
65
0100 0001
B
66
0100 0010
C
67
0100 0011
D
68
0100 0100
E
69
0100 0101
F
70
0100 0110
G
71
0100 0111
H
72
0100 1000
I
73
0100 1001
J
74
0100 1010
K
75
0100 1011
L
76
0100 1100
M
77
0100 1101
60
Sect 2: Upper Case Letter Representations
Keyboard Character
ASCII Number
Binary Representation
N
78
0100 1110
O
79
0100 1111
P
80
0101 0000
Q
81
0101 0001
R
82
0101 0010
S
83
0101 0011
T
84
0101 0100
U
85
0101 0101
V
86
0101 0110
W
87
0101 0111
X
88
0101 1000
Y
89
0101 1001
Z
90
0101 1010
61
Sect 2: Lower Case Letter Representations
Keyboard Character
ASCII Number
Binary Representation
a
97
0110 0001
b
98
0110 0010
c
99
0110 0011
d
100
0110 0100
e
101
0110 0101
f
102
0110 0110
g
103
0110 0111
h
104
0110 1000
i
105
0110 1001
j
106
0110 1010
k
107
0110 1011
l
108
0110 1100
m
109
0110 1101
Note the only difference in the binary representation of ‘A’ and ‘a’ is the third digit
from the left is changed from a 0 to a 1.
62
Sect 2: Lower Case Letter Representations
Keyboard Character
ASCII Number
Binary Representation
n
110
0110 1110
o
111
0110 1111
p
112
0111 0000
q
113
0111 0001
r
114
0111 0010
s
115
0111 0011
t
116
0111 0100
u
117
0111 0101
v
118
0111 0110
w
119
0111 0111
x
120
0111 1000
y
121
0111 1001
z
122
0111 1010
63
Sect 2: Representation of Non-Text Data
Besides numbers and letters that are text …. sounds, images, and
video can be represented by binary numbers.
This is why sounds are able to be heard, images displayed, and
videos watched on a computer.
They are all converted from analog to digital and then back to analog
when used.
64
Sect 2: The Representation of Sound
Information contained in
sound is analog and is
represented by a
continuous waveform.
In order to store a sound in a computer file, it must be digitized into
1s and 0s. As the sound is played it is converted back to analog form
so a speaker can play it.
To store the sound, it must be “sampled” at regular intervals along
its waveform. If it is sampled at a higher rate like 44,000 samples per
second, then the representation of the sound is of a higher quality
(CD Quality). The higher the sampling rate then the higher the quality
of the sound. So digital sound requires a large amount of storage, but
not as much as video.
65
Sect 2: The Representation of Images
Images are also analog information and must be represented by 1s
and 0s on a computer.
An image can be thought of as a set of color and intensity values
spread across a two-dimensional space like a rectangle.
An image is stored as a large number of pixels where each pixel has a
color and intensity value.
Scanners and digital cameras collect and store these values in one file
for a picture or graphic.
Black-and-white images can be represented by 2 bits per pixel.
Grayscale images can be represented by 8 bits per pixel for 256
shades of gray.
True color images (RGB) are represented by 24 bits per pixel.
66
Sect 2: The Representation of Video
Video consists of a soundtrack and video frames. So a video is
a set of pictures recorded in a sequence during a given time interval,
where each frame is essentially a still picture made up of many pixels.
Standard broadcast video is made up of 30 frames (pictures) pere
second.
The primary challenge in digitizing video is data compression. As
video is recorded, there is a huge amount of information stored in the
form of 1s and 0s and it all has to be placed in one file. A video file can
get extremely large so compression is used to reduce the size of the
file so it can be handled by a computer quickly. This is why some very
large files take a long time to display on a computer.
67
Sect 2: Computer Memory
An memory address is a byte’s location in RAM memory or cache.
Cache is temporary memory where data that is being used a lot is
temporarily held so it can be accessed quicker.
Addresses are numbered from 0 to 1 less than the number of bytes
of memory installed on the computer using binary numbers.
Adjacent bytes may store different types of data.
So computer memory is a gigantic sequence of bytes, each with an
address.
68
Sect 2: Computer RAM Memory
32MB of RAM Memory
RAM stands for Random
Access Memory and can
be envisioned as a stack
of individual memory
locations.
69
Section 3
Programming Languages
70
Section 3: Programming Languages
Programming languages have evolved since the early days of
computers. This section will discuss the different
generations of programming languages.
1. Generation 1 - machine languages.
2. Generation 2 - assembly languages.
3. Generation 3 - high-level languages.
You should be able to list them in this order from the earliest
languages to the most current languages.
71
Section 3: Machine Languages
1. Generation 1—machine languages. Using machine languages,
program data was entered directly into RAM in the form of 1s and
0s by toggling switches, using patch cords and later punch cards.
It was error prone, tedious, and slow. The following shows how
the code would be written for machine, assembler, and the C
programming language.
72
Section 3: Assembly Languages
2. Generation 2—assembly languages. These languages used mnemonic
symbols to represent instructions and data. Each symbol had a unique
representation of 1s and 0s and so it was easier than than programming
with machine-language instructions. These languages have assemblers
and loaders:
•
•
Assembler: Translates the assembly language to machine language
Loader: Loads machine language into memory so it can be executed
MOV AX,0006h
MOV BX,AX
MOV AX,4C00h
INT 21H
Assembly Language can be quite cryptic!
Generally, only computer engineers use
assembly languages.
This small program moves the value of 0006H to the AX register, then it
moves the content of AX (0006h) to the BX register, and lastly it moves the
4C00h value to the AX register to end the execution with the 4C option of
the 21h interruption. Don’t worry you are not going to have to do that!
73
Section 3: High-Level Languages
3. Generation 3—high-level languages. These languages have
been designed to be easy to read, write, and manipulate, because
they are closer to English words. Examples of these kind of
languages are:
Fortran, COBOL, Pascal, C, C++, Java
A compiler translates high-level language instructions into machine
language instructions. Eclipse is the software we will use to write
Java programs. It contains a compiler so you can write, compile and
run a Java program.
74
Section 3: Hardware & Software
Modern computers consist of two primary components:
hardware and software.
Hardware is the physical components of a computer.
Software consists of programs or applications that are stored
on a computer. Software enables us to use the hardware.
75
Section 4
The Software Development Process
76
Section 4: The Software Development Process
Software, whether system software or application software, is
developed in phases over a period of time by teams of
programmers.
Most programmers refer to this process as the Software
Development Life Cycle. It’s a cycle because after a piece of
software is developed, the cycle starts over. (You’ll see in a minute.)
The life cycle helps to standardize software development by
simplifying the understanding of a program by breaking it down into
meaningful parts and therefore minimizing software flaws.
77
Section 4: The Software Development Process
In this version of the Software Development Life Cycle, each phase naturally
leads to the next phase:
•
Phase 1: Customer request - a software is needed by someone
•
Phase 2: Analysis - programmers analyze all that is needed to be included
in the software
•
Phase 3: Design - programmers break down the software down into
manageable parts that can be completed independently
•
Phase 4: Implementation - programmers write the code
•
Phase 5: Integration - the software is integrated with any existing software
components
•
Phase 6: Maintenance - programmers run, test, and debug the software to
insure than it works correctly.
After customers use the software, they make additional requests for what they
want the software to be able to do and the process starts over again.
78
Section 4: The Software Development Process
Some
programmers
call this the
Waterfall
model
because one
phase
naturally
leads to
another.
79
Section 4: The Software Development Process
Relative costs of repairing mistakes when found in different
phases. Notice how expensive the cost of maintaining software is.
80
Section 4: The Software Development Process
Percentage of total cost incurred in each phase of the
development process
81
Section 4: The Software Development Process
Given the 6 parts of the software development process, you should be able to
list them in the correct sequence. For example, if you are given the
following 6 parts as follows:
Maintenance Customer request Implementation Design Analysis Integration
You should be able to place them in order based on the meaningful sequence
in which the different parts take place:
Customer request
Analysis
Design
Implementation
Integration
Maintenance
82
Section 5
Intro to Object-Oriented Programming
83
Section 5: Intro to Object-Oriented Programming
There are two major groups of high-level languages:
– Procedural languages: COBOL, FORTRAN, BASIC, C, Pascal
– Object-oriented languages: Smalltalk, C++, Java
Procedural Languages don’t use objects. However, versions of some
of them have been developed, for instance Objective C.
•
Object-oriented languages use objects and emphasize the reuse of
code. Programmers write classes and libraries of code that are
always available to them for any programming project. The benefit
is a savings of time because you don’t have to keep rewriting the
same code for a new program.
In object-oriented languages, programmers write class files to define
specific kinds of objects they need in their programs. A class file
can be modified and updated with very few side-effects to programs
that are already using the class. You will learn how to write a class
so that you can define your own kind of objects.
84
Section 5: Intro to Object-Oriented Programming
•
Object-oriented programming takes a divide-and-conquer
approach, where a program consists of one or more software
components called classes.
•
A class defines the data components of an object and the
operations that can be performed on that object. In Java, we
like to say …. a class defines the characteristics (data
components) and the messages that can be sent to the object
(operations).
•
When programmers write a class and combine the data
components and operations, this is called encapsulation.
85
Section 5: Intro to Object-Oriented Programming
To be more specific, objects have two parts. Below are the
different ways that programmers refer to the two parts.
characteristics
methods
data components
operations
data resources
messages that can be sent
instance variables
A Circle object may
have these
characteristics: a
radius, and a color.
A Circle has methods or
operations that allow
programs to calculate a
Circle’s diameter,
circumference, and area,
as well as obtain its radius.
86
Section 5: Intro to Object-Oriented Programming
•
When a program begins running, it instantiates
(creates or constructs) the objects needed within the
program.
•
Objects work together to accomplish the mission of
the program. Objects send each other messages to
request services or data.
•
When an object receives a message, it refers to its
class to find the corresponding method to execute.
87
Section 5: Intro to Object-Oriented Programming
Later in this class you will learn numerous terms that
describe specific things related to object-oriented
programming. We mention a few of them now as an
introduction, but we will discuss them later in the
context of working with them.
Information hiding
Inheritance
Polymorphism
88
Section 6
The ACM Code of Ethics
and
Copyright Laws
89
Section 6: The ACM Code of Ethics
The ACM (Association for Computing Machinery) is the flagship
organization for computing professionals from industry and
education. It promotes the growth of members through
conferences and other educational events and promotes
standards of ethical responsibility. The next few slides list
several of the general moral imperatives of computer
professionals:
• Contribute to society and human well-being.
• Avoid harm to others.
• Be honest and trustworthy.
• Be fair and take action not to discriminate.
• Honor property rights, including copyrights and patents.
• Give proper credit for intellectual property.
• Respect the privacy of others.
• Honor confidentiality.
90
Section 6: The ACM Code of Ethics
The code also lists several more specific professional
responsbilities:
• Strive to achieve the highest quality,effectiveness, and dignity
in both the process and products of professional work.
• Acquire and maintain professional work.
• Know and respect existing laws pertaining to professional
work.
• Accept and provide appropriate professional review.
• Give comprehensive and thorough evaluations of computer
systems and their impacts, including analysis of possible risks.
• Honor contracts, agreements, and assigned responsibilities.
• Improve public understanding of computing and its
consequences.
• Access computing and communication resources only when
authorized to do so.
91
Section 6: Copyright Laws
Copyright laws regulate the use of intellectual property. This
includes recorded music, film, video and printed matter. It also
includes software and other forms of digital information.
Copyright laws protect the authors against illegal replication of
materials for the purpose of giving it to other people.
However, copyright laws allow for fair use of materials that allow
the purchaser to make backup copies of software for their
personal use. If the purchaser sells the software to someone
else then he or she relinquishes the right to use it.
In designing laws, government tries to balance the rights of
authors and publishers against the rights of the public to fair
use. Without fair use, you wouldn’t be able to borrow a book
from the school library or play a CD at a high school dance.
With an ever increasing amount of digital information in our
culture that can be easily transmitted over networks and the
internet, the traditional balance of ownership rights and fair
use is being re-evaluated.
92
Chapter 1 Section 1 Review
•
The modern computer age began in the late 1940s with the
development of ENIAC.
•
Business computing became practical in the 1950s, and timesharing computers advanced computing in large organizations
in the 1960s and 1970s.
•
The 1980s saw the development and first widespread sales of
personal computers.
•
The 1990s gave rise to the first computer networks which
allowed the general public to use the internet.
93
Chapter 1 Section 1 Review
•
From earliest to latest, the progression of electronic
components:
mechanical relays
vacuum tubes
transistors
integrated circuits
Note: According to Wikipedia: “A microprocessor incorporates
the functions of a computer's central processing unit (CPU) on
a single integrated circuit, or at most a few integrated circuits.”
So essentially, a microprocessor is an integrated circuit.
94
Chapter 1 Section 2 Review
•
From smallest to largest, the units of size that are
standard in relation to memory size on computers is:
kilobyte
megabyte
gigabyte
terabyte
95
Chapter 1 Section 2 Review
Originally, computers in the United States used ASCII to
translate English numbers and letters to binary code.
However, as computers began to be used universally around the
world, more and more of them used Unicode to translate
numbers and letters to binary code not just for English but all
the other languages of the world.
96
Chapter 1 Section 3 Review
•
Modern computers consist of two primary
components: hardware and software.
•
Computer hardware is the physical component of
the system.
•
Computer software consists of programs that
enable us to use the hardware.
97
Chapter 1 Section 4 Review
•
All information used by a computer is represented in
binary form. This information includes numbers, text,
images, sound, and program instructions.
•
Programming languages have been developed in
this order in the course of three generations:
–
–
–
generation 1 is machine language
generation 2 is assembly language
generation 3 is high-level language
98
Chapter 1 Section 5 Review
The software development process consists of several standard
phases:
• customer request
• analysis
• design
• implementation
• integration
• maintenance (most expensive - requires the most time)
Object-oriented programming is a style of programming that can
lead to better quality software. Breaking code into easily
handled components called classes simplifies the job of
writing a large program.
99
Download