DOC PREVIEW
Duke CPS 100E - Notes

This preview shows page 1-2-3-4-5 out of 16 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 16 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 16 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 16 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 16 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 16 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 16 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CompSci 100e 1.1 Welcome! Program Design and Analysis II for Engineers CompSci 100E Perkins 107 M, W 4:25-5:40 Professor: Jeffrey Forbes http://www.cs.duke.edu/courses/fall09/cps100e CompSci 100e 1.2 What is Computer Science? !! What does a computer scientist do? !! What does a programmer do? !! What are the various subfields of computer science? What binds them together? !! What do you want to do?CompSci 100e 1.3 What is Computer Science? What is it that distinguishes it from the separate subjects with which it is related? What is the linking thread which gathers these disparate branches into a single discipline? My answer to these questions is simple --- it is the art of programming a computer. It is the art of designing efficient and elegant methods of getting a computer to solve problems, theoretical or practical, small or large, simple or complex. C.A.R. (Tony) Hoare CompSci 100e 1.4 Programming != Computer Science !! What is the nature of intelligence? How can one predict the performance of a complex system? What is the nature of human cognition? Does the natural world 'compute'? !! It is the interplay between such fundamental challenges and the human condition that makes computer science so interesting. The results from even the most esoteric computer science research programs often have widespread practical impact. Computer security depends upon the innovations in mathematics. Your Google search for a friend depends on state-of-the-art distributed computing systems, algorithms, and artificial intelligence. http://www.post-gazette.com/pg/pp/04186/341012.stmCompSci 100e 1.5 Efficient design, programs, code Object-oriented design and patterns. Software design principles transcend language, but … Engineer, scientist: what toolkits do you bring to programming? Mathematics, design patterns, libraries --- standard and others… Know data structures and algorithms. Trees, hashing, binary search, sorting, priority queues, greedy methods, graphs … Using the language: Java (or C++, or Matlab, or …), its idioms, its idiosyncracies CompSci 100e 1.6 Course Overview !! Active Lectures, Labs, Quizzes, Programs !! Labs based on questions given out in previous week •! Hands-on practice with programming •! Discuss answers, answer new questions, small quiz •! More opportunities for questions to be answered. !! Active Lectures based on readings, questions, programs •! Online quizzes used to motivate/ensure reading •! In-class questions used to ensure understanding !! Programs •! Theory and practice of data structures and OO programming •! Fun, practical, tiring, … •! Weekly APT programs and longer programs !! Exams/Tests !! Semester: open book/note* !! Final: open book/noteCompSci 100e 1.7 Tradeoffs Simple, elegant, quick, efficient: what are our goals in programming? Don’t worry about getting it right the first time. How do we decide what tradeoffs are important? Tension between generality, simplicity, elegance, … Fast programs, small programs,. Runtime, space, your time, CPU time… Time vs. space Programming, design, algorithmic, data-structural CompSci 100e 1.8 Languages !! Machine languages. !! Natural languages. !! High-level programming languages. [ real newspaper headlines, compiled by Rich Pattis ] Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want a computer to do. - Donald Knuth "!Kids Make Nutritious Snacks. "!Red Tape Holds Up New Bridge. "!Police Squad Helps Dog Bite Victim. "!Local High School Dropouts Cut in Half. Pictures Natural language (English) Pseudo-code Specific high-level programming language Machine Language More easily expressed More precise © Sedgewick & WayneCompSci 100e 1.9 Why Java? !! Java features. !! Widely used. !! Widely available. !! Embraces full set of modern abstractions. !! Variety of automatic checks for mistakes in programs. !! Java economy. !! Mars rover. !! Cell phones. !! Blu-ray Disc. !! Web servers. !! Medical devices. !! Supercomputing. !! … James Gosling http://java.net/jag © Sedgewick & Wayne CompSci 100e 1.10 Why Java? !! Java features. !! Widely used. !! Widely available. !! Embraces full set of modern abstractions. !! Variety of automatic checks for mistakes in programs. !! Caveat. I'm one of the few crazies... who believes it's very possible the Internet has been underhyped instead of overhyped... I predict over the next 90 days Java is going to be like a drug you rub over venture capitalists and they go crazy. - John Doerr There are only two kinds of programming languages: those people always [gripe] about and those nobody uses. - Bjarne Stroustrup © Sedgewick & WayneCompSci 100e 1.11 Why Java? !! Java features. !! Widely used. !! Widely available. !! Embraces full set of modern abstractions. !! Variety of automatic checks for mistakes in programs. !! Caveat. No perfect language. !! Our approach. !! Minimal subset of Java. !! Develop general programming skills that are applicable to: C, C++, C#, Perl, Python, Ruby, Matlab, Fortran, Fortress, … © Sedgewick & Wayne CompSci 100e 1.12 A Rich Subset of the Java Language Primitive Numeric Types != == >= <= < > -- / + % - ++ * Integer.parseInt() Double.parseDouble() Parsing Math.max() Math.min() Math.pow() Math.sqrt() Math.PI Math.abs() Math.log() Math.sin() Math Library Math.exp() Math.cos() System.out.println() System.out.print() System.out.printf() System for if Flow Control while else ! || true Boolean && false ; , ( { Punctuation ) } a[i] new a.length Arrays matches() charAt() length() + String compareTo() "" boolean char long int Built-In Types String double equals() toString() main() new public class Objects private static © Sedgewick & WayneCompSci 100e 1.13 Programming in Java !!Programming in Java. !! Create the program by typing it into a text editor, and save it as HelloWorld.java HelloWorld.java /******************************************* * Prints "Hello, World" * Everyone's first Java program. *******************************************/ public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World"); } } © Sedgewick & Wayne CompSci 100e 1.14 Programming in Java !!Programming in Java. !! Create the program by typing it into a text editor, and save it as HelloWorld.java !! Compile it using Eclipse or by typing at the command-line: javac HelloWorld.java


View Full Document

Duke CPS 100E - Notes

Documents in this Course
Topics

Topics

9 pages

Lecture

Lecture

3 pages

Notes

Notes

2 pages

Hashing

Hashing

19 pages

Lecture

Lecture

59 pages

Lecture

Lecture

6 pages

Lecture

Lecture

4 pages

Lecture

Lecture

20 pages

Lecture

Lecture

12 pages

Lecture

Lecture

12 pages

Lecture

Lecture

7 pages

Lecture

Lecture

8 pages

Lecture

Lecture

10 pages

Lecture

Lecture

4 pages

Lecture

Lecture

5 pages

Lecture

Lecture

9 pages

Lecture

Lecture

4 pages

Lecture

Lecture

13 pages

Lecture

Lecture

6 pages

Lecture

Lecture

16 pages

Lecture

Lecture

5 pages

Lecture

Lecture

5 pages

Lecture

Lecture

12 pages

Lecture

Lecture

12 pages

Lecture

Lecture

10 pages

Sets

Sets

14 pages

Lecture

Lecture

9 pages

Lecture

Lecture

4 pages

Test 1

Test 1

7 pages

Load more
Download Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?