CS2 (Java) Exam 1 Review - UIC

advertisement
Some Computer
Science Conceptual
Background Material
Doug Hogan
This version for UIC Spring 2016 CS 107
Software Overview:
Two Kinds of Software
System software
Controls basic operations of computer
 The operating system



manages memory, files, application software
File management tasks – deleting, etc.
Software Overview:
Two Kinds of Software
Application software
Not essential to system running
 Enables you to perform specific tasks
 Ex:

Office software
 Web browsers
 Media players
 Games

Algorithms and Languages
An algorithm is a set of instructions to solve a
problem.
Think recipes.
Many algorithms may solve the same
problem.

How do we choose?
We use a programming language to explain
our algorithms to computer and write
programs.
Programming Paradigms/Models
Imperative Programming: specify steps to
solve problem, use methods, methods could
get long
Object-Oriented Programming (OOP): create
objects to model real-world phenomena, send
messages to objects, typically shorter
methods
Event-Driven Programming: create methods
that respond to events like mouse clicks, key
presses, etc.
Others: Functional, logic, etc.
Compiled vs. Interpreted
Languages
Interpreted Language



Requires software called
an interpreter to run the
code
Code is checked for
errors as it runs
(erroneous code: do the
best we can…)
Examples: HTML,
JavaScript, PHP
Compiled Language



Requires software called
a compiler to run the
code
Code must be compiled
into an executable before
running (and thus errorfree)
Examples: C, C++,
Pascal, Fortran, BASIC
Compiling Process
Source
Code
(C++,
Fortran, …)
compiler
Object
Code
linker
Object
Code from
Libraries
Executable
Program
Errors
Syntax Errors


Misuse of the language, much like using incorrect
punctuation in English
Compiler reports; program won’t run until they’re
resolved
Logic Errors

Program doesn’t solve the problem at hand
correctly
Runtime Errors

Errors that occur while the program is running,
e.g. problems accessing memory and files, divide
by zero
Abstraction
Poll:




Who can use a cell phone?
Who can explain how a cell phone works?
Who can drive a car?
Who is an auto mechanic?
Abstraction




Principle of ignoring details that allows us to use
complex devices
Focus on the WHAT, not the HOW
Fundamental to CS
Other examples?
Levels of Abstraction
0. Digital Logic
1. Microprocessor
2. Machine Language
3. Operating System
4. Assembly Language
5. High-Level Language
6. Application Software
Binary Numbers
Use two symbols: 0 and 1
Base 2
Compare with decimal number system
Uses symbols 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
 Base 10

At the lowest level of abstraction,
everything in a computer is expressed
in binary.
Binary Numbers, ctd.
0
1
10
11
100
101
110
111
1000
1001
1010
1011
1100
1101
1110
1111
10000
Places:


Decimal: 1s, 10s, 100s,
etc.
Binary, 1s, 2s, 4s, 8s, etc.
Conversion between
decimal and binary is
done by multiplying or
adding by powers of 2.
Other Number Systems
Any positive integer could be the base
of a number system. (Big topic in
number theory.)
Others used in computer science:
Octal: Base 8
 Hexadecimal:

Base 16
 New symbols A, B, C, D, E, F

ASCII
Every character on a computer -- letters,
digits, symbols, etc. -- is represented by
a numeric code behind the scenes.
This system of codes is called ASCII,
short for American Standard Code for
Information Interchange.
We’ll learn more in lab…
Download