* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Chapter 1 Notes
Structured programming wikipedia , lookup
Name mangling wikipedia , lookup
Abstraction (computer science) wikipedia , lookup
Computer cluster wikipedia , lookup
Java (programming language) wikipedia , lookup
Go (programming language) wikipedia , lookup
History of compiler construction wikipedia , lookup
Java ConcurrentMap wikipedia , lookup
Java performance wikipedia , lookup
Sections 1.1-1.11
Student-Teacher
relationships are very
important
Exposure+bewilderment=Obvious
Computers
are faster
Computers are more accurate
Computers never forget
If humans give faulty instructions/Enter
Data Sloppily, than the computer may
give erroneous information
Morse
Code is based on “on” and “off”
signals that relay a message
In Morse Code, electricity can be turned
on and off
In Binary Code:
1-On
0-Off
We
use the decimal system (base
10)every day
• Each digit represents a power of 10
In
Computer Science, we use the binary
system, or base 2
• Each digit represents a power of 2
• 01000001=65
ASCII: American
Standard Code for
Information Interchange
0-127 are used for the standard set of
characters
128-255 are used for the extended set
• A=65 or 01000001
ASCII
can store one character per byte
ASCII has up to 256 characters
Unicode
uses 2 bytes to store characters
Has a possibility of 65,536 Characters
Java has adopted Unicode
Bit-A
Binary Digit that is either on(1) or
off(0)
1 Byte-8 bits
1 Nibble-4 bits
1 Byte-256 different combinations
2 Bytes-65,536 different combinations
ASCII-Uses one byte to store one
character
Unicode-Uses two bytes to store one
character
Early
computers used vacuum tubes to
store information (One bit per vacuum
tube)
Vacuum Tubes were then replaced by
transistors, and later, microchips
ROM-Read Only Memory, where
permanent information is stored
RAM-Random Access Memory, where
information is temporarily stored
1
Kilobyte contains exactly 1,024 bytes
CPU-Central Processing Unit; brains of
the computer
CD- A secondary storage device that
stores information by absorbing laser
light
Analog-Continuous
Digital-Exact, copies can be made of this
Hardware-Physical
Software-Set
of instructions that make the
computer perform a task
CPU-Central Processing Unit
The System Unit is the piece of hardware
that contains the CPU and computer
memory
External
Peripheral Devices-Outside the
computer, connected to an interface
• Examples: Headphones, Speakers, Flash Drive,
Mouse, Microphone
Internal
Peripheral Devices-Inside of the
System Unit
• Examples: CD ROM, Hard Drive, Disk Drive,
Network Interface Card, Video Card
Application
Software-Instructions
required by the computer to do perform
a specific task for you
• Examples: Word Processors/Spreadsheets
• Sometimes referred to as an “app” on a cell
phone
System
Software-Instructions that the
computer requires to operate correctly
• Example: Operating System
• Windows, Linux, UNIX, Mac OS
Operating
Systems can be used to:
1. Move/Store Data
2. Personalize the computer
3. Install peripheral devices
4. Install/Execute Applications
5. Install Anti-Virus
Section 1.9
When
counting on fingers/toes became
too restricting, people began to mark
rocks or tie knots in ropes to count
The Abacus was invented in 3000 BC in
the Middle East
John Napier: Invented logarithms and
designed an efficient way to do Lattice
Multiplication
Slide
Rule: Created by William Oughtred;
Allowed sophisticated mathematical
calculations
• Replaced by the scientific calculator in 1970s
Blaise
Pascal: Built the Pascaline, the first
numerical counting machine in 1642
• Still used in 1970s because of the price of 4-
function calculator
Jacquard's
Loom: Used punch cards to
program the loom into creating certain
patterns
Charles
Babbage: Created the first
general purpose computing machine
• “The Father of Computers”
Ada
Byron: Began designing computer
programs before modern computers
existed
• “The Mother of Programming”
Tabulating
Machine: Invented by Herman
Hollerith for 1890 Census; used punch
cards
Differential Analyzer: Invented by Harold
Locke Hazen and Vannevar Bush; capable
of large scale equations
Konrad Zuse: Credited by some to be the
“Inventor of the Computer”; created a
programmable computer destroyed in
WWII
Mark-I: IBM’s
first Automatic Sequence
Control Calculator; dubbed Mark-I by
Harvard
• 51 ft. long, 8 ft. tall
Grace
Hopper: One of the first
programmers of the Mark-I, had many
contributions to Computer Science
Mark-II: On 9/9/1947, Mark-II stopped
working; a moth was stuck in the computer
• First “Computer Bug”
Vacuum Tubes: Size
of a normal light
bulb, 8 of these were used for the
computer to process a single character;
Marks beginning of the “First Generation
of Computers”
Atanasoff Berry Computer: The first
electronic digital computer
Colossus: Used by British to decrypt
secret coded messages of Germans in
WWII
ENIAC: Electronic
Numerical Integrator
and Computer; First electronic general
purpose computer
EDVAC: Electronic Discrete Variable
Automatic Computer; First stored
program computer
UNIVAC: UNIVersal Automatic Computer,
the first commercially available
computer
Transistors: Much
smaller than vacuum
tubes, and lasted much longer; Marked the
beginning of the Second Generation of
Computers
Integrated Circuits: Developed by Jack Kilby
in 1958, circuits have multiple transistors on
each chip. Marked the beginning of the
Third Generation of Computers
Microchips today hold billions of transistors
System/360: Essentially
standardized
computer hardware
Apple II Personal Computer: Created by
Steve Jobs and Steve Wozniak of Apple
Computer Inc. This was the first successful
personal computer
IBM PC: First personal computer to be taken
seriously in the business world; had a
monochrome monitor and two floppy drives
Toshiba: First commercially successful
computer to use a mouse and Windows
MS-DOS: Created
by Bill Gates and
Microsoft as the first operating system for
the IBM PC
Compaq: Known for the first portable
computer and the first computer to be 100%
compatible with the IBM PC
GUI: Graphics User Interface
Mouse Technology: Created by Xerox
Lisa: Created by Apple, first commercially
successful computer with mouse and GUI
technology
Introductory
Computer Science courses
traditionally focus on programming
Program: A sequence of instructions
which enables a computer to perform a
desired task
Programmer: A person who writes a
program for the computer
Programming the ENIAC requires
rewiring the machine
Machine
Language: Also Machine Code;
Directly manipulating the 1s and 0s of the
computer’s binary language.
EDSAC: Electronic Display Storage
Automatic Computer; Introduced Assembly
Language
Initial Orders: Name of the assembler in the
EDSAC
Grace Hopper: Coined the term
“debugging”; nicknamed “Amazing Grace”
Low
Level Languages: Machine Language
and Assembly Language; They function at
or close to the level of 1s and 0s
High Level Languages: FORTRAN,
COBOL, Java; A language that uses
English words as instructions
Very High Level Languages: NXT; Uses
pictures you click and drag to program
the computer
Translator: Translates
a high level
language into low level machine code
Compiler: Translates the entire program
into an executable file before execution
Interpreter: Translates one statement at a
time during execution
FORTRAN: FORmula TRANslator; first
successful programming language;
designed for Mathemeticians, Scientists
and Engineers
LISP: Known for being one of the
languages specifically designed to
develop Artificial Intelligence
COBOL: Common Business Oriented
Language; designed for the business
community
PL/I: Programming
Language 1; IBM
designed PL/I to standardize software, by
combining FORTRAN and COBOL.
• Never became popular because FORTRAN users did
not like the COBOL features and vice versa
BASIC: Created
by Tom Kurtz and John
Kemeny for non-math and non-science
majors.
• Became popular when personal computers were
released because the memory was too small for
FORTRAN or COBOL
• College professors did not like this because it didn’t
teach programming structure properly
Pascal: Created
by Niklaus Wirth for the
purpose of teaching programming.
• Differs from PL/I because it has just enough math
from FORTRAN and just enough record handling
from COBOL
NXT: Created
by the Lego Corporation; Very
high level language, uses point and click
language
BCPL: Originally intended for writing
compilers
• Updated, renamed C, then C++
• Uses OOP: Object Oriented Programming
Sneaker
Net: Early computers were not
networked; Used this system to share
files
Peer-to-Peer Networks: First practical
network for personal computers; All
computers are equal
Server: A specialty computer connected
to a network for printing, data storage,
website management etc.
LAN: Local
Area Network
Internet: Came about in The Cold War; No
central location so it cannot be destroyed
Intranet: A series of LANs that are
connected to a large network
ISP: Internet Service Provider
Sections 2.3-2.12
The
United Nations has about 200 countries
and uses a two step translation process, with
English as the intermediate area.
• A one step translation process would need 20,000
translators
Java
also uses a two step translation process,
using a compiler to turn the source code to
bytecode and an interpreter to go from
bytecode to machine code
A
programming language is considered
platform independent if the source code
can execute on another platform without
difficulty
Compiler: Usually translates the code into
an executable file before execution
• In Java, it translates the source code into Bytecode
• Larger than interpreters
Interpreter: Translates
the source code one
line at a time during execution
• In Java, it translates Bytecode into machine code
Bytecode: The
intermediate code created
by the Java compiler; A low level code
that cannot execute as a regular machine
code file
• Is understood and executed by a JRE
JRE: Java
Runtime Environment; a Java
interpreter
HTML: Hyper Text
Markup Language; a
special program language for webpages
Applet: A Java program designed to
operate inside a web page
• A web page can contain multiple applets, but
cannot be written entirely in Java
Application: A
Java program designed to
operate in a stand alone environment
JDK: Java
Development Kit, free of charge,
a Java compiler
You need a text editor, compiler, and
interpreter to write a Java program.
IDE: Integrated Development
Environment; contains all three things
above
All java programs end with .java
Java
compiler can be accessed through
the Command Prompt
All Bytecode files end with .class
JDK must be installed before JCreator
JCreator is an IDE; is not the only IDE
available
GUI: Graphics
User Interface
Program Input is more complex than
program output
//: This is a one line comment code; is not
shown when the program is run(does not
get compiled)
Every application has a main segment
Sytem.out.println: Outputs data and puts
the cursor on the next line
{}: Contain
program blocks
Programming languages cannot use
human language because there are too
many words that share meanings
Java Keyword: A word that has a special
meaning in a program/performs a
special function
• Two or more keywords combine to make a
program
Keywords
are case sensitive; System is a
keyword, system is not
Keywords: public, class, static, void, main,
String, System, out, println
CRLF: Carriage Return Line Feed; after
displaying the data, it sends the next line
of data to the next line
println contains a crlf, print does not
• Both follow keywords System.out
If
the program is named Jessica.java, then
the program must say public class Jessica
A semicolon must be at the end of all Java
statements
Comments aid in program
documentation
• A well documented program is easy to read
debug, update, enhance
Sections 3.1-3.12
Variables
make math, science, and
computer science possible
Keywords are what make up a computer
program
Java
compilers will only compile if the
source code obeys the Java syntax
First Java syntax rule: Only keywords
known to Java can be used in the
program
Three categories of keywords: Reserved
words, Predefined Java Identifiers, UserDefined Identifiers
Java Reserved Words: public, static, void
Pre-Defined
Identifiers: print, println
User-Defined Identifiers: cannot be a
Reserved word or Pre-defined identifier
• To name it, you may use alphanumeric
characters and the underscore. Must start with
alpha character
To
declare an integer x, int x; is the
proper form
To
assign int x a value use int x = 7; as a
single statement
The four data types of Java are byte,
short, int, long
Int: contains 4 bytes
Largest value of a byte is 127
5 integer operations: Addition,
Subtraction, Multiplication, Quotient
Division, Remainder Division
Quotient
Division is traditional division,
and remainder division calculates the
remainder after division
Float
and Double are two data types used
for real numbers
Addition, Subtraction, Multiplication, and
Division are the four real number
operations
• Real number remainder division is possible but
not practical
The
Rollover effect is applied similar to
when a car hits 100,000 miles. The
maximum display is reached, and makes
the sign number negative
Memory Overflow is when the value of a
variable exceeds the storage space
allocated
X++/++X: X=X+1
X--/--X: X=X-1
Do
not combine shortcuts with Java
Statements or other shortcuts, they
become hard to follow
X+=5: X=X + 5
X-=5: X=X - 5
X*=5: X=X * 5
X/=5: X=X / 5
X%=5: X=X % 5
Char
is the data type used to process
individual characters
• Single quotations mark a char data type
String
is the data type used to process
sets of one or more characters
• Double quotations mark a String data type
“Chaining” is
when multiple variables
are set equal to a value
Concatenation
is when the plus sign is
used to join strings together
• “100” + “200”=“100200”
Overloading: Overloading
is when an
operator is used to perform different
functions
George
Boole developed Boolean
Algebra, which is statements that are
either true or false
• Boolean data types, true or false only, are used
today in Computer Science
Primitive
data types: Java’s formal
language for simple data types
To
set a number as a constant(the
number will never change) type as final
double doubleConst=xxxxx;
• If you try to alter the variable of a constant, the
program will not compile
Java
calls final variables constants
The
first form of program documentation
is to use comments
In the 1960s-70s computer programs
were often written with single letter
variables to save memory space
A self-commenting variable is a variable
with a name that describes the purpose
of the variable
Variables
should now be words or
compounds, not single letters
Comments should still be used even if
self-commenting variables are used
Java
follows the same Order of
Operations that are used in math
Traditional Math
Java source code
7abc
7*a*b*c
x+3/2x-7
(x+3)/(2x-7)
½
1.0/2.0
Type casting is used in Java to make sure that the
correct data type is assigned to a variable
• System.out.println(10/3); = 3
• System.out.println((double)10/3); = 3.3333333
Escape Sequence: A single slash followed by
some character placed between double quotes
\n: Carriage Return Line Feed
\t: tab
Escape sequences are used to create
backslashes and quotations because these keys
are already used as operators