1. computers - uni-weimar.de file1. computers prof. dr. charles wüthrich mfa gianluca pandolfo,...

36
1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media Bauhaus-University Weimar

Upload: ngokien

Post on 05-Aug-2019

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1. Computers - uni-weimar.de file1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media ... A not quite so minimal computer October 2017 Charles

1. Computers

Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media Bauhaus-University Weimar

Page 2: 1. Computers - uni-weimar.de file1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media ... A not quite so minimal computer October 2017 Charles

A Computer

•  From a young age, today people are used to use one or more computers

October 2017 Charles Wüthrich 2

Page 3: 1. Computers - uni-weimar.de file1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media ... A not quite so minimal computer October 2017 Charles

A Computer

•  From a young age, today people are used to use one or more computers

October 2017 Charles Wüthrich 3

Page 4: 1. Computers - uni-weimar.de file1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media ... A not quite so minimal computer October 2017 Charles

A Computer

•  From a young age, today people are used to use one or more computers

October 2017 Charles Wüthrich 4

Cou

rtesy

Bun

desa

rchi

v

Page 5: 1. Computers - uni-weimar.de file1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media ... A not quite so minimal computer October 2017 Charles

What makes a computer?

October 2017 Charles Wüthrich 5

Page 6: 1. Computers - uni-weimar.de file1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media ... A not quite so minimal computer October 2017 Charles

A minimal computer

October 2017 Charles Wüthrich 6

Processor

Page 7: 1. Computers - uni-weimar.de file1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media ... A not quite so minimal computer October 2017 Charles

A minimal computer

October 2017 Charles Wüthrich 7

Memory

Processor

Page 8: 1. Computers - uni-weimar.de file1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media ... A not quite so minimal computer October 2017 Charles

A minimal computer

October 2017 Charles Wüthrich 8

Memory

Processor

I/O

Page 9: 1. Computers - uni-weimar.de file1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media ... A not quite so minimal computer October 2017 Charles

A minimal computer

October 2017 Charles Wüthrich 9

Memory

Processor

I/O

Page 10: 1. Computers - uni-weimar.de file1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media ... A not quite so minimal computer October 2017 Charles

Hardware

A minimal computer

October 2017 Charles Wüthrich 10

Memory

Processor

I/O

Page 11: 1. Computers - uni-weimar.de file1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media ... A not quite so minimal computer October 2017 Charles

Hardware

A less minimal computer

October 2017 Charles Wüthrich 11

Memory

Processor

I/O O

pera

ting

Syst

em (O

S)

Page 12: 1. Computers - uni-weimar.de file1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media ... A not quite so minimal computer October 2017 Charles

Hardware

A less minimal computer

October 2017 Charles Wüthrich 12

Memory

Processor

I/O O

pera

ting

Syst

em (O

S)

Page 13: 1. Computers - uni-weimar.de file1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media ... A not quite so minimal computer October 2017 Charles

Hardware

A more realistic computer

October 2017 Charles Wüthrich 13

Memory

Processor

I/O O

pera

ting

Syst

em (O

S) Harddrive …

Bus

Page 14: 1. Computers - uni-weimar.de file1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media ... A not quite so minimal computer October 2017 Charles

Hardware

A not quite so minimal computer

October 2017 Charles Wüthrich 14

Memory

Processor

I/O

Ope

ratin

g Sy

stem

(OS)

Gra

phic

al U

ser I

nter

face

GU

I

HD ..

Bus

Page 15: 1. Computers - uni-weimar.de file1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media ... A not quite so minimal computer October 2017 Charles

A not quite so minimal computer

October 2017 Charles Wüthrich 15

Page 16: 1. Computers - uni-weimar.de file1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media ... A not quite so minimal computer October 2017 Charles

The file system

•  All data organized in a file system (on your HD) like a tree

•  Root directory: / •  Subdirectories:

–  /dir1/ /dir2/ …"

•  Subsubdirectories –  /dir1/sub1 /sub2 /… /dir2/sub1 /sub2 /… … and so on..."

October 2017 Charles Wüthrich 16

Page 17: 1. Computers - uni-weimar.de file1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media ... A not quite so minimal computer October 2017 Charles

Command Line Interface (CLI)

•  All systems have a Command Line Interface where you can type commands for the computer Mac: Terminal"

October 2017 Charles Wüthrich 17

Page 18: 1. Computers - uni-weimar.de file1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media ... A not quite so minimal computer October 2017 Charles

Moving in the file system

•  Change directory you are working at: from the CLI type cd "

•  Example: cd / "

•  Current directory: ."

•  Up directory.. cd ..

October 2017 Charles Wüthrich 18

Page 19: 1. Computers - uni-weimar.de file1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media ... A not quite so minimal computer October 2017 Charles

Listing files

•  From any directory position: ls"

•  Example: ls ./introcs/ ArtistsLoveJava.java "hello " "lovejava checkstyle-5.5 " "java3d" "stdlib.jar findbugs-2.0.3 " "log.txt"

•  Lists the subdirectory of the current directory named introcs

"

October 2017 Charles Wüthrich 19

Page 20: 1. Computers - uni-weimar.de file1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media ... A not quite so minimal computer October 2017 Charles

Editing files

•  You will need an editor application, such as: nano emacs . . . ."

•  Example: nano myfile.txt "

October 2017 Charles Wüthrich 20

Page 21: 1. Computers - uni-weimar.de file1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media ... A not quite so minimal computer October 2017 Charles

My first program

October 2017 Charles Wüthrich 21

Page 22: 1. Computers - uni-weimar.de file1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media ... A not quite so minimal computer October 2017 Charles

Compiling my first program

October 2017 Charles Wüthrich 22

Page 23: 1. Computers - uni-weimar.de file1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media ... A not quite so minimal computer October 2017 Charles

Compiling my first program

•  Compiling: a “translator” compiles your high level code into a now level code understandable by the machine

•  A compiler does exactly this, and achieves machine (or in our case java virtual machine) executable code

•  This code is then ready to be “executed” by the machine so as to “run” your instructions

October 2017 Charles Wüthrich 23

Page 24: 1. Computers - uni-weimar.de file1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media ... A not quite so minimal computer October 2017 Charles

Running my first program

October 2017 Charles Wüthrich 24

Page 25: 1. Computers - uni-weimar.de file1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media ... A not quite so minimal computer October 2017 Charles

My first program (IDE)

October 2017 Charles Wüthrich 25

Page 26: 1. Computers - uni-weimar.de file1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media ... A not quite so minimal computer October 2017 Charles

My first program

October 2017 Charles Wüthrich 26

Page 27: 1. Computers - uni-weimar.de file1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media ... A not quite so minimal computer October 2017 Charles

Errors

•  When you write a program there are three types of errors that can happen –  Compile time: the compiler cannot understand the code you

typed in because it does not conform to the syntax –  Execution time: the machine tries to execute the code you

wrote (which compiles correctly). •  Possible causes: Division by zero, trying to touch things that

you are not allowed to touch (in the system) –  Logical errors: most difficult to catch.

Wrong results, program behaves erratically…. Catching these is both frustrating and rewarding.

October 2017 Charles Wüthrich 27

Page 28: 1. Computers - uni-weimar.de file1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media ... A not quite so minimal computer October 2017 Charles

Controlling (a bit) Input and Output

•  I’d like to discuss with you a new simple program:

•  This time, the program has more lines •  The computer starts at the main line, and executes

each of the 3 lines one after the other •  What do these lines do?

October 2017 Charles Wüthrich 28

Page 29: 1. Computers - uni-weimar.de file1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media ... A not quite so minimal computer October 2017 Charles

Controlling (a bit) Input and Output

•  The first line simply prints the content of the brackets in the CLI

October 2017 Charles Wüthrich 29

Page 30: 1. Computers - uni-weimar.de file1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media ... A not quite so minimal computer October 2017 Charles

Controlling (a bit) Input and Output

October 2017 Charles Wüthrich 30

•  The second line prints a thing which is called “args[0]” •  And who is this?

Page 31: 1. Computers - uni-weimar.de file1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media ... A not quite so minimal computer October 2017 Charles

Controlling (a bit) Input and Output

October 2017 Charles Wüthrich 31

•  The second line prints a thing which is called “args[0]” •  And who is this? •  For now, to you, “args[0]” contains the first thing you

typed after calling the program name when you run the code: java ReadArgument sillycreature

Page 32: 1. Computers - uni-weimar.de file1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media ... A not quite so minimal computer October 2017 Charles

Controlling (a bit) Input and Output

•  The second line prints a thing which is called “args[0]” •  And who is this? •  For now, to you, “args[0]” contains the first thing you

typed after calling the program name when you run the code: java ReadArgument sillycreature will contain “sillycreature”

October 2017 Charles Wüthrich 32

Page 33: 1. Computers - uni-weimar.de file1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media ... A not quite so minimal computer October 2017 Charles

Controlling (a bit) Input and Output

•  The third line prints “and yours?” •  So what is the result if we type

java ReadArgument worms in the console?

October 2017 Charles Wüthrich 33

Page 34: 1. Computers - uni-weimar.de file1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media ... A not quite so minimal computer October 2017 Charles

Controlling (a bit) Input and Output

October 2017 Charles Wüthrich 34

My favourite pets are worms. And yours?

Page 35: 1. Computers - uni-weimar.de file1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media ... A not quite so minimal computer October 2017 Charles

Controlling (a bit) Input and Output

October 2017 Charles Wüthrich 35

My favourite pets are worms. And yours?

•  Notice the different use of “print” and “println”

Page 36: 1. Computers - uni-weimar.de file1. Computers Prof. Dr. Charles Wüthrich MfA Gianluca Pandolfo, CoGVis/MMC, Faculty of Media ... A not quite so minimal computer October 2017 Charles

+++ Ende - The end - Finis - Fin - Fine +++ Ende - The end - Finis - Fin - Fine +++

End