Upload
hilel-snider
View
61
Download
0
Tags:
Embed Size (px)
DESCRIPTION
Java. The Art and Science of. An Introduction. to Computer Science. ERIC S. ROBERTS. C H A P T E R 1. Introduction. [The Analytical Engine offers] a new, a vast, and a powerful language . . . for the purposes of mankind. —Augusta Ada Byron, Lady Lovelace, 1843. Chapter 1—Introduction. - PowerPoint PPT Presentation
Citation preview
Chapter 1—Introduction
Introduction
C H A P T E R 1
[The Analytical Engine offers] a new, a vast, and a powerful language . . . for the purposes of mankind.
—Augusta Ada Byron, Lady Lovelace, 1843
The Art and Science of
An Introductionto Computer ScienceERIC S. ROBERTS
Java
CS101 @ Özyeğin University
Slides are adapted from the originals available athttp://www-cs-faculty.stanford.edu/~eroberts/books/ArtAndScienceOfJava/
What is Computer Science?• In its classical use, science refers to the study of natural
phenomena.
• Many people imagine that computer science is the study of computers as artifacts and wonder how that can be a science.
• Car science?
• Refrigerator engineering?
What is Computer Science?• Computer science has more to do with the study of problem
solving in which the solutions happen to use computers.
• Computing/Computation Science?
• Computer science draws on a range of intellectual traditions that includes aspects of mathematics, classical science, and engineering.
• Computer science plays an increasingly important role in other disciplines:– Biology. Computers made it possible to map the human genome.– Economics. Computers enable the creation of better economic
models.– Psychology. Artificial intelligence helps us to understand the brain.– Environment. Climate models require modern computing technology.– Literature. Computerized analysis helps resolve disputed authorship.– and most everything else . . .
Computer• From Wikipedia:
• A computer is a programmable machine designed to carry out a sequence of arithmetic or logical operations.
• The particular sequence of operations can be changed readily, allowing the computer to solve more than one kind of problem.
Eniac [http://ftp.arl.mil/ftp/historic-computers]
Components of a Computer• Hardware: Physical parts. Tangible.
• Software: Programs. Abstract, intangible.
• Combination of hardware and software makes computation possible.
A Brief Tour of Computer Hardware
CPU
memory
secondarystorage
I/Odevices
network
bus
Central Processing Unit• “The Brain”
• Actual computation and coordination of the entire computer
• May be more than one: Multiprocessor
• May have more than one computation units: Multicore
Memory• Retains data
• Both program data and program itself
• Volatile: Data is lost when power is off.
• RAM (Random Access Memory): Allows the program to use the contents of any memory cell at any time.
Secondary Storage• Retains data
• Long-term. High capacity.
• Persistent: Data is preserved when power is off.
• CD, DVD, Flash drive, tape, harddisk.
Input• Receive data from input devices
Output• Pass data to output devices
Network• Connection to other computers.
• Internet: Vast collection of computers throughout the world that are connected together by communication lines that allow them to share data and programs.
From Amazon.com
Algorithms• Much of computer science involves the study of
algorithms.
• A procedure/strategy for solving a problem.
• Derived from the name of the Persian mathematician al-Khwarizmi, who wrote the book Kitab al jabr w’al-muqabala.
Algorithms• To meet its more formal definition, an algorithm
must be:– Clearly and unambiguously defined.– Effective, in the sense that its steps are executable.
– Bad: “multiply r by the exact value of π”.– Finite, in the sense that it terminates after a bounded
number of steps.– There may be more than one algorithm to solve a
problem.– Complexity of the algorithm plays a crucial role
in which one to use.
A simple algorithm for presentation
Slide visible?
Control the projector
Control the computer
Start
No
A simple algorithm for presentation
Slide visible?
Control the projector
Control the computer
Present the content
questions?
Answer the question
Start
No
Yes
Yes
A simple algorithm for presentation
Slide visible?
Control the projector
Control the computer
Present the content
Last slide?
questions?
Answer the question
Switch to the next slide
Start
End
No
Yes
No
Yes
No
Yes
Algorithm as a simple program
01. REPEAT until the last slide02. IF slide is visible03. Present the content04. ELSE05. Control the projector06. Control the computer07. RETURN TO step #0208. REPEAT for each question 09. Answer the question10. SWITCH to next slide
01. REPEAT until the last slide02. IF slide is visible03. Present the content04. ELSE05. Control the projector06. Control the computer07. RETURN TO step #0208. REPEAT for each question 09. Answer the question10. SWITCH to next slide
Algorithm as a simple program
similar to keywords of a programming
language
Numbered lines of code A line of code in the program
Java and the World-Wide Web• Part of Java’s success comes from the fact that it is the first
language specifically designed to take advantage of the power of the World-Wide Web, which came into prominence shortly before Java’s release in 1995.
• In addition to more traditional application programs, Java makes it possible to write small interactive programs called applets that run under the control of a web browser.
• The programs that you will learn to write in this book run as either applications or applets, which means that you can easily share them on the web.