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 get a better job & higher pay. Fun – Really! 3
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 4
What is Computer Science? The study of imperative knowledge Imperative Knowledge — How to do something Declarative Knowledge — What something is (by definition) 5
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? 6
What is Computer Science? The only science that builds what we measure. – John Day 7
Problem Solving Big Idea #1 Recursion: You can define something in terms of itself. Example: Divide & Conquer 8
Problem Solving Big Idea #1 Recursion: You can define something in terms of itself. Example: Divide & Conquer 9
Abstraction Big Idea #2 Abstraction: Giving something a name makes it more useful. Example: 10
Computing 11
Computing 12
Programs, Inputs, & Outputs Program: input output 1. read from input file file: file: 2. for each pixel x in the file: compute 7 – x image1 image2 3. save to output file 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 output; can be executed, etc. 13
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 , …) 14
Black Box Abstraction Big Idea #4 Black Box Abstraction: We can use something without knowing (precisely) how it works. Applications Program Modules We can start High Level Programming Language in the middle! Assembly Language Machine Code / Digital Circuits 15
Complexity Abstraction lets us manage complexity. + ~ 2 million lines of code ~ 50 million lines of code ~ 2 billion transistors 16
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 10001100101010010000000000000000 10001100101010100000000000000100 10001100101010110000000000001000 00000001001010100001100000100000 00000000011010110001100000100000 00000011111000000000000000001000 00100000000001010000001111101000 00001100000100000000000000000000 10101100101000110000000000001100 17
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 output.add_pixel(y) write_image_file (output, ‘scary.png’) 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 • 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!) 19
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). C++ x86 C++ to x86 source machine Compiler code code 20
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 Python source Interpreter code 21
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 22
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 23
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. 24
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! 25
Recommend
More recommend