1 Survey of Computer Science Kevin Walsh kwalsh@holycross.edu - - PowerPoint PPT Presentation

1 survey of computer science
SMART_READER_LITE
LIVE PREVIEW

1 Survey of Computer Science Kevin Walsh kwalsh@holycross.edu - - PowerPoint PPT Presentation

xkcd.com/519 1 Survey of Computer Science Kevin Walsh kwalsh@holycross.edu http://cs.holycross.edu/~csci110/ Readings: CSI 1, 9.2 Motivation Why are we here? Mandatory required to graduate. Education CS is neat! Profit you will


slide-1
SLIDE 1

1

xkcd.com/519

slide-2
SLIDE 2

Kevin Walsh kwalsh@holycross.edu

Survey of Computer Science

http://cs.holycross.edu/~csci110/ Readings: CSI 1, 9.2

slide-3
SLIDE 3

3

Motivation

Why are we here? Mandatory – required to graduate. Education – CS is neat! Profit – you will get a better job & higher pay. Fun – Really!

slide-4
SLIDE 4

4

What is Computer Science?

  • Computer Graphics
  • Numerical and Symbolic Computation
  • Artificial Intelligence and Robotics
  • Algorithms and Data Structures
  • Computer Architecture
  • Database and Information Retrieval
  • Human-Computer Communication
  • Software Engineering
  • Operating Systems
  • Programming Languages (& Compiler Construction)
  • Social, Ethical and Professional Context
slide-5
SLIDE 5

5

What is Computer Science?

The study of imperative knowledge Imperative Knowledge— How to do something Declarative Knowledge— What something is (by definition)

slide-6
SLIDE 6

6

What is Computer Science?

What can be (efficiently) computed or automated? + How can we do it in practice? + Let's build things! + What did we build?

slide-7
SLIDE 7

7

What is Computer Science?

The only science that builds what we measure. – John Day

slide-8
SLIDE 8

8

Problem Solving

Big Idea #1 Recursion: You can define something in terms of itself. Example: Divide & Conquer

slide-9
SLIDE 9

9

Problem Solving

Big Idea #1 Recursion: You can define something in terms of itself. Example: Divide & Conquer

slide-10
SLIDE 10

10

Abstraction

Big Idea #2 Abstraction: Giving something a name makes it more useful. Example:

slide-11
SLIDE 11

11

Computing

slide-12
SLIDE 12

12

Computing

slide-13
SLIDE 13

13

Programs, Inputs, & Outputs

Abstractions:

  • Pixel: a dot; has a color and a location
  • Image file: a set of pixels; can be read, saved, etc.
  • Program: a recipe for computing; takes an input and an
  • utput; can be executed, etc.

input file: image1 Program:

  • 1. read from input file
  • 2. for each pixel x in the file:

compute 7 – x

  • 3. save to output file
  • utput

file: image2

slide-14
SLIDE 14

14

Encoding

Big Idea #3: Encoding: Most everything can be encoded as data. (And you can compute with data.) Examples:

  • Text files (doc, txt, …)
  • Image files (jpg, gif, …)
  • Audio files (mp3, wma, …)
  • Video files (DVD, youtube, …)
  • Mixed media (web pages, powerpoint, …)
  • Programs (exe, dll, …)
slide-15
SLIDE 15

15

Black Box Abstraction

Big Idea #4 Black Box Abstraction: We can use something without knowing (precisely) how it works.

Applications Program Modules High Level Programming Language Assembly Language Machine Code / Digital Circuits

We can start in the middle!

slide-16
SLIDE 16

16

Complexity

Abstraction lets us manage complexity. +

~ 2 million lines of code ~ 50 million lines of code ~ 2 billion transistors

slide-17
SLIDE 17

17

10001100101010010000000000000000 10001100101010100000000000000100 10001100101010110000000000001000 00000001001010100001100000100000 00000000011010110001100000100000 00000011111000000000000000001000 00100000000001010000001111101000 00001100000100000000000000000000 10101100101000110000000000001100

Machine Code

Machine code is binary coded instructions (sequences of 0’s and 1’s).

  • Used directly by computer hardware
  • Not fit for human consumption
  • Not portable: e.g. MIPS, ARM, x86, …
  • Runs only on specific type of computer
slide-18
SLIDE 18

18

High Level Languages

High-level languages are closer to natural languages.

  • A compiler translates a high-level language

program into a machine language program

input = read_image_file(‘mario.png’) for each x in input.pixels(): y = 7 – x

  • utput.add_pixel(y)

write_image_file(output, ‘scary.png’)

slide-19
SLIDE 19

19

High Level Languages

High-level languages are closer to natural languages.

  • A compiler translates a high-level language

program into a machine language program

  • Portable (in principle)
  • Examples: C, C++, C#, Javascript, Perl, Ruby, Java,

Python, FORTRAN, ALGOL, COBOL, Visual Basic, Ada, Lisp, Scheme

– Each language has a separate set of compilers (as many as one for each machine language!)

slide-20
SLIDE 20

20

Early and Late Compilation

  • 1. Programmer writes program in a high-level

language.

  • 2. A compiler translates it into a machine language

program.

  • 3. The computer executes the result.

(which the computer later executes).

x86 machine code

C++ to x86 Compiler

C++ source code

slide-21
SLIDE 21

21

Early and Late Compilation

An interpreter translates a high-level language program into a machine language program and immediately executes it.

  • Can even be interactive!

Python Interpreter

Python source code

slide-22
SLIDE 22

22

Which Language to use?

Which high-level language to use? C, C++, C#, Javascript, perl, php, ruby, Java, Pascal, Python, Visual Basic, smalltalk, mathmatica, maple, Lisp, Scheme, ML, assembly, Postscript, FORTRAN, ALGOL, COBOL, … Learn one, learn them all!

  • Same control structures and main ideas

 The concepts transfer between languages. Python is a good teaching language

  • Interactive: try out programs as you write them
  • Easier to learn than many other languages
  • Lots of existing code, examples, tutorials, etc.
  • Actually useful in the real world
slide-23
SLIDE 23

23

Administration

http://cs.holycross.edu/~csci110/

  • Lecture slides & schedule, assignments, etc.
  • Links to Python compiler & documentation

Office Hours

– Mondays 1pm – 3pm – Thursdays 10am – noon – By appointment

Grading:

  • Lab worksheets

(10%)

  • Homework & projects

(30 %)

  • Two midterm exams

(20 % each)

  • Final exam

(20%)

23

slide-24
SLIDE 24

24

Academic Integrity

Academic Integrity:

  • All submitted work must be your own (or your groups)

– OK to study together, but do not share solutions

  • Cite your sources

Stressed? Tempted? Lost?

  • Come see me before due date!

Plagiarism in any form will not be tolerated.

slide-25
SLIDE 25

25

Announcements

Announcements Questionnaire – Due Friday before class Lab 1 – Wednesday Readings for today – CSI 1, 9.2 Readings for Friday – CSI 9.4, Py 1.1-1.5 Enrollment – There is plenty of room in Section 02!