what is computer science? … and why should you care?
TRANSCRIPT
![Page 1: What is Computer Science? … and why should you care?](https://reader036.vdocuments.mx/reader036/viewer/2022071807/56649e115503460f94afc708/html5/thumbnails/1.jpg)
What is Computer Science?
… and why should you care?
![Page 2: What is Computer Science? … and why should you care?](https://reader036.vdocuments.mx/reader036/viewer/2022071807/56649e115503460f94afc708/html5/thumbnails/2.jpg)
What is a “computer”• Oxford English Dictionary (partial entries)
1. A person who makes calculations2. A device for facilitating calculations3. Device used to [do long list of things with]
information according to variable instructions
![Page 3: What is Computer Science? … and why should you care?](https://reader036.vdocuments.mx/reader036/viewer/2022071807/56649e115503460f94afc708/html5/thumbnails/3.jpg)
Variable Instructions• I can give it inputs that change how it reacts to
future inputs• Many approximately “universal”– Universal = can teach it to do anything– “Approximately” because memory is limited
![Page 4: What is Computer Science? … and why should you care?](https://reader036.vdocuments.mx/reader036/viewer/2022071807/56649e115503460f94afc708/html5/thumbnails/4.jpg)
How many computers have you used in the past two weeks?
![Page 5: What is Computer Science? … and why should you care?](https://reader036.vdocuments.mx/reader036/viewer/2022071807/56649e115503460f94afc708/html5/thumbnails/5.jpg)
How many computers?• Car• Microwave oven• Laptop computer• Cell phone• Thermostat• This classroom
• Power meter• Cash register• Crosswalk signal• Your apartment• Used to access a
single web page
![Page 6: What is Computer Science? … and why should you care?](https://reader036.vdocuments.mx/reader036/viewer/2022071807/56649e115503460f94afc708/html5/thumbnails/6.jpg)
So many…• Why so many?• Any risks to having them everywhere?
![Page 7: What is Computer Science? … and why should you care?](https://reader036.vdocuments.mx/reader036/viewer/2022071807/56649e115503460f94afc708/html5/thumbnails/7.jpg)
![Page 8: What is Computer Science? … and why should you care?](https://reader036.vdocuments.mx/reader036/viewer/2022071807/56649e115503460f94afc708/html5/thumbnails/8.jpg)
What is programming?• Teaching a computer what it should do• Are computers good students?
![Page 9: What is Computer Science? … and why should you care?](https://reader036.vdocuments.mx/reader036/viewer/2022071807/56649e115503460f94afc708/html5/thumbnails/9.jpg)
What is programming?• Teaching a computer what it should do• Are computers good students?– Never forget anything– Make no mistakes– Incredibly stupid
• The lessons we teach it called “code”
![Page 10: What is Computer Science? … and why should you care?](https://reader036.vdocuments.mx/reader036/viewer/2022071807/56649e115503460f94afc708/html5/thumbnails/10.jpg)
What is “Hacking”• Several uses
1. Rapid development of code2. Sloppy development of code3. Trying to break other people’s code (next slide)
![Page 11: What is Computer Science? … and why should you care?](https://reader036.vdocuments.mx/reader036/viewer/2022071807/56649e115503460f94afc708/html5/thumbnails/11.jpg)
What is (malicious) Hacking?• Most programs: “do X, Y, Z, and don’t listen to
anyone else telling you to do differently”• “don’t listen to anyone else” is hard to say– We won’t even try this semester
• Hacking = finding ways to get other people’s code to listen to you
![Page 12: What is Computer Science? … and why should you care?](https://reader036.vdocuments.mx/reader036/viewer/2022071807/56649e115503460f94afc708/html5/thumbnails/12.jpg)
Layers of Languages
![Page 13: What is Computer Science? … and why should you care?](https://reader036.vdocuments.mx/reader036/viewer/2022071807/56649e115503460f94afc708/html5/thumbnails/13.jpg)
Why “language”?• It’s how we know how to teach– Plus it’s traditional, keyboards are fast, …
• Syntax, Semantics, Vocabulary– “Flow run ghxsr fla"vor toast-toats olg”– “Put the tire in itself for chanting sneezes”– “Prandial soleation is gauche”
![Page 14: What is Computer Science? … and why should you care?](https://reader036.vdocuments.mx/reader036/viewer/2022071807/56649e115503460f94afc708/html5/thumbnails/14.jpg)
Why “code”?section .datastr: db 'Hello world!', 0Ahstr_len: equ $ - str
section .textglobal _start
_start:mov eax, 4mov ebx, 1mov ecx, strmov edx, str_lenint 80hmov eax, 1mov ebx, 0int 80h
public class Hi { public static void main(String[] args) { System.out.println(“Hello world!“); }}
• Lots of languages, all look like some kind of code– But designed (i.e., simple rules)
• We’ll learn “Java”
![Page 15: What is Computer Science? … and why should you care?](https://reader036.vdocuments.mx/reader036/viewer/2022071807/56649e115503460f94afc708/html5/thumbnails/15.jpg)
Program Flow
Java source code Byte code BehaviorCompile Run
Syntax Errors
Vocabulary Errors
Semantics Errors(Exceptions)
Logic Mistakes
![Page 16: What is Computer Science? … and why should you care?](https://reader036.vdocuments.mx/reader036/viewer/2022071807/56649e115503460f94afc708/html5/thumbnails/16.jpg)
1. We write Java (source code)2. It is “compiled” to “byte code” by “compiler”– Unless syntax wrong; then get syntax error– Or vocabulary wrong; then “unknown symbol” error
3. Byte code is “run” or “executed” by “java virtual machine”– Unless semantics wrong; then get runtime Exception
4. Program does something– Might do “wrong” thing; called a logic error
![Page 17: What is Computer Science? … and why should you care?](https://reader036.vdocuments.mx/reader036/viewer/2022071807/56649e115503460f94afc708/html5/thumbnails/17.jpg)
![Page 18: What is Computer Science? … and why should you care?](https://reader036.vdocuments.mx/reader036/viewer/2022071807/56649e115503460f94afc708/html5/thumbnails/18.jpg)