23
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 Introduction to Computer Science ERIC S. ROBERTS Ja va 101 @ Özyeğin University ides are adapted from the originals available at tp://www-cs-faculty.stanford.edu/~eroberts/books/ArtAndScienceOfJava

Chapter 1—Introduction

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

Page 1: Chapter 1—Introduction

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/

Page 2: Chapter 1—Introduction

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?

Page 3: Chapter 1—Introduction

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 . . .

Page 4: Chapter 1—Introduction

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.

Page 5: Chapter 1—Introduction

Eniac [http://ftp.arl.mil/ftp/historic-computers]

Page 6: Chapter 1—Introduction

Components of a Computer• Hardware: Physical parts. Tangible.

• Software: Programs. Abstract, intangible.

• Combination of hardware and software makes computation possible.

Page 7: Chapter 1—Introduction

A Brief Tour of Computer Hardware

CPU

memory

secondarystorage

I/Odevices

network

bus

Page 8: Chapter 1—Introduction

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

Page 9: Chapter 1—Introduction

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.

Page 10: Chapter 1—Introduction

Secondary Storage• Retains data

• Long-term. High capacity.

• Persistent: Data is preserved when power is off.

• CD, DVD, Flash drive, tape, harddisk.

Page 11: Chapter 1—Introduction

Input• Receive data from input devices

Page 12: Chapter 1—Introduction

Output• Pass data to output devices

Page 13: Chapter 1—Introduction

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.

Page 14: Chapter 1—Introduction

From Amazon.com

Page 15: Chapter 1—Introduction

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.

Page 16: Chapter 1—Introduction

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.

Page 17: Chapter 1—Introduction
Page 18: Chapter 1—Introduction

A simple algorithm for presentation

Slide visible?

Control the projector

Control the computer

Start

No

Page 19: Chapter 1—Introduction

A simple algorithm for presentation

Slide visible?

Control the projector

Control the computer

Present the content

questions?

Answer the question

Start

No

Yes

Yes

Page 20: Chapter 1—Introduction

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

Page 21: Chapter 1—Introduction

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

Page 22: Chapter 1—Introduction

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

Page 23: Chapter 1—Introduction

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.