A Computer Science Tapestry 1.1 Wake up with CPS 006 Program Design and Methodology I Jeff Forbes

Slides:



Advertisements
Similar presentations
 Bheemarjuna Reddy Tamma IIT Hyderabad Lecture 1.
Advertisements

Chapter 1 An Overview of Computers and Programming Languages.
Computability & Complexity. Scenario I can’t write this program because I’m too dumb.
CSC 2400 Computer Systems I Lecture 3 Big Ideas. 2 Big Idea: Universal Computing Device All computers, given enough time and memory, are capable of computing.
FLAC Lecture 19 Turing Machines and Real Life * Reductions Mihai Budiu March 3, 2000.
The Binary Machine Modern high-level programming languages are designed to make programming easier. On the other end, the low level, all modern digital.
Chapter Chapter Goals Describe the layers of a computer system Describe the concept of abstraction and its relationship to computing Describe.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. slide 1 CS 125 Introduction to Computers and Object- Oriented Programming.
A Computer Science Tapestry 1.1 A Computer Science Tapestry Exploring Programming and Computer Science with C++ Second Edition Owen Astrachan Duke University.
1 Lecture 1  Getting ready to program  Hardware Model  Software Model  Programming Languages  The C Language  Software Engineering  Programming.
Introduction to Computers and Programming. Some definitions Algorithm: –A procedure for solving a problem –A sequence of discrete steps that defines such.
1. By the end of this lecture you should be able … To describe in general terms how computers function To describe the fetch-execute cycle To explain.
CS 104 Introduction to Computer Science and Graphics Problems Software and Programming Language (2) Programming Languages 09/26/2008 Yang Song (Prepared.
Introduction to Computers and Programming. Some definitions Algorithm: Algorithm: A procedure for solving a problem A procedure for solving a problem.
Theory of Computation. Computation Computation is a general term for any type of information processing that can be represented as an algorithm precisely.
Software Development CS 1 Rick Graziani Spring 2007.
Chapter 0: Introduction CSCI-UA 0002 – Introduction to Computer Programming Mr. Joel Kemp.
CPS Welcome! Principles of Computer Science CPS 1 LSRC B101 M, W, F 1:10-2:00 Professor Dietolf (Dee) Ramm
1 I.Introduction to Algorithm and Programming Algoritma dan Pemrograman – Teknik Informatika UK Petra 2009.
PROCESSING Designing and developing a program. Objectives Understand programming as the process of writing computer instructions that achieve a goal Understand.
Welcome Aboard – Chapter 1 COMP 2610 Dr. James Money COMP
THE PROCESS OF WRITING SOFTWARE Python: System Engineering 1.
CPS What is Computer Science? What is it that distinguishes it from the separate subjects with which it is related? What is the linking thread.
CompSci Welcome! Principles of Computer Science CompSci 1 LSRC B101 M, W, F 1:30-2:20 Professor Jeff Forbes.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
CS Introduction to Computing
High level & Low level language High level programming languages are more structured, are closer to spoken language and are more intuitive than low level.
Duke University Computer Science 1 Why Computer Science is Uglier and Prettier than Mathematics Owen Astrachan Duke University
Overview of Computing. Computer Science What is computer science? The systematic study of computing systems and computation. Contains theories for understanding.
CompSci Welcome! Principles of Computer Science CompSci 1 LSRC B101 M, W, F 10:20-11:10 Professor Jeff Forbes See
Introduction CS 104: Applied C++ What is Programming? For some given problem: __________ a solution for it -- identify, organize & store the problem's.
David Evans Turing Machines, Busy Beavers, and Big Questions about Computing.
CS 102 Computers In Context (Multimedia)‏ 01 / 23 / 2009 Instructor: Michael Eckmann.
CompSci 1: Principles of Computer Science Lecture 1 Course Overview.
CompSci Welcome! Principles of Computer Science CompSci B101 LSRC M W F 1:30-2:20 Dietolf (Dee) Ramm
Lecture on Computer Science as a Discipline. 2 Computer “Science” some people argue that computer science is not a science in the same sense that biology.
1 CPSC 185 Introduction to Computing The course home page
Gülşen Demiröz Fall 2011 CS 201 Introduction to Computing.
CPS Welcome! Principles of Computer Science CPS 1 LSRC B101 M, W, F 10:30-11:20 Professor Jeff Forbes.
CS201 - Intro. to Sabancı University1 CS Introduction to Computing Albert Levi FENS 1091
Genome Revolution: COMPSCI 006G 1.1 FOCUS COMPSCI 006G Genome Revolution Owen Astrachan
CompSci CompSci 6 Programming Design and Analysis I Dietolf (Dee) Ramm
Algorithms & Flowchart
Computer Science and Everything 1 Big Ideas in Computer Science l “Mathematics is the Queen of the Sciences” Carl Friedrich Gauss l What is Computer Science?
The Nature of Computing INEL 4206 – Microprocessors Lecture 3 Bienvenido Vélez Ph. D. School of Engineering University of Puerto Rico - Mayagüez.
The Nature of Computing INEL 4206 – Microprocessors Lecture 2 Bienvenido Vélez Ph. D. School of Engineering University of Puerto Rico - Mayagüez.
Software Design 14.1 CPS 108 l Object oriented design and programming of medium-sized projects in groups using modern tools and practices in meaningful.
Data Structures and Algorithms Dr. Tehseen Zia Assistant Professor Dept. Computer Science and IT University of Sargodha Lecture 1.
Introduction 1 (Read Chap. 1) What is Programming? For some given problem: design a solution for it -- identify, organize & store the problem's data --
CPS What is Computer Science? What is it that distinguishes it from the separate subjects with which it is related? What is the linking thread.
 Programming - the process of creating computer programs.
Complexity & Computability. Limitations of computer science  Major reasons useful calculations cannot be done:  execution time of program is too long.
CS150: Computer Organization and Architecture Michael D. Wilder, Ph.D.
Theory of Computation. Introduction We study this course in order to answer the following questions: What are the fundamental capabilities and limitations.
Lecture 1b- Introduction
CSCI-235 Micro-Computer Applications
Computer Programming.
Introduction to Computer Engineering
CompSci 6 Introduction to Computer Science
Introduction to Computer Engineering
Turing Machines, Busy Beavers, and Big Questions about Computing
Welcome Aboard 1.
Introduction to Computer Engineering
Teori Bahasa dan Automata Lecture 1: Course Overview and Introduction
Principles of Programming Languages
CompSci 1: Principles of Computer Science Lecture 1 Course Overview
Half-life of knowledge
Tonga Institute of Higher Education IT 141: Information Systems
Tonga Institute of Higher Education IT 141: Information Systems
Presentation transcript:

A Computer Science Tapestry 1.1 Wake up with CPS 006 Program Design and Methodology I Jeff Forbes

A Computer Science Tapestry 1.2 Computer Science and Programming l Computer Science is more than programming  The discipline is called informatics in many countries  Elements of both science and engineering Scientists build to learn, engineers learn to build –Fred Brooks  Elements of mathematics, physics, cognitive science, music, art, and many other fields l Computer Science is a young discipline  Fiftieth anniversary in 1997, but closer to forty years of research and development  First graduate program at CMU (then Carnegie Tech) in 1965 l To some programming is an art, to others a science, to others an engineering discipline

A Computer Science Tapestry 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

A Computer Science Tapestry 1.4 Computer Science l Artificial Intelligencethinking machines l Scientific Computingweather, cars, heart, modelling l Theoretical CSanalyze algorithms, models l Computational Geometrytheory of animation, 3-D models l Architecturehardware-software interface l Software Engineeringengineering, science l Operating Systemsthe soul of the machine l Graphicsfrom Windows to Hollywood l Many other subdisciplines

A Computer Science Tapestry 1.5 Stories l Who is Shawn Fanning and what did he do (19 years old)? l Who is Marc Andreessen and what did he do (21 years old)? l Who is Claude Shannon and what did he do (21 years old)? l Who is Linus Torvalds and what did he do (21 years old)? l Who is Dmitry Sklyarov and what did he do (26 years old)? l Who is Tim Berners-Lee and what did he do (35 years old)? l Who is Owen Astrachan and what did he do (44 years old)?

A Computer Science Tapestry 1.6 Algorithms as Cornerstone of CS l Step-by-step process that solves a problem  more precise than a recipe  eventually stops with an answer  general process rather than specific to a computer or to a programming language l Searching: for phone number of G. Samsa, whose number is , or for the person whose number is  Are these searches different? l If the phone book has 8 million numbers in it (why are there only 7.9 million phone numbers with area code 212?)  How many queries to find phone number of G. Samsa?  How many queries to find person with number  What about IP addresses?

A Computer Science Tapestry 1.7 Search, Efficiency, Complexity l Think of a number between 1 and 1,000  respond high, low, correct, how many guesses needed? l Look up a word in a dictionary  Finding the page/word, how many words do you look at? l Looking up a phone number in the Manhattan, NY directory  How many names are examined? l How many times can 1,024 be cut in half?  2 10 = 1,024, 2 20 = 1,048,576

A Computer Science Tapestry 1.8 Sorting Experiment: why do we sort? l Groups of four people are given a bag containing strips of paper  on each piece of paper is an 8-15 letter English word  create a sorted list of all the words in the bag  there are 100 words in a bag l What issues arise in developing an algorithm for this sort?  l Can you write a description of an algorithm for others to follow?  Do you need a support line for your algorithm?  Are you confident your algorithm works?

A Computer Science Tapestry 1.9 Themes and Concepts of CS l Theory  properties of algorithms, how fast, how much memory  average case, worst case: sorting cards, words, exams  provable properties, in a mathematical sense l Language  programming languages: C++, Java, C, Perl, Fortran, Lisp, Scheme, Visual BASIC,more?  Assembly language, machine language,  Natural language such as English l Architecture  Main memory, cache memory, disk, USB, SCSI,...  pipeline, multi-processor

A Computer Science Tapestry 1.10 Theory, Language, Architecture l We can prove that in the worst case quicksort is bad  doesn’t matter what machine it’s executed on  doesn’t matter what language it’s coded in  unlikely in practice, but worst case always possible l Solutions? Develop an algorithm that works as fast as quicksort in the average case, but has good worst case performance  quicksort invented in 1960  introsort (for introspective sort) invented in 1996 l Sometimes live with worst case being bad  bad for sorting isn’t bad for other algorithms, needs to be quantified using notation studied as part of the theory of algorithms

A Computer Science Tapestry 1.11 Abstraction, Complexity, Models l What is an integer?  In mathematics we can define integers easily, infinite set of numbers and operations on the numbers (e.g.,+, -, *, /) {…-3, -2, -1, 0, 1, 2, 3, …}  In programming, finite memory of computer imposes a limit on the magnitude of integers. Possible to program with effectively infinite integers (as large as computation and memory permit) at the expense of efficiency At some point addition is implemented with hardware, but that’s not a concern to those writing software (or is it?) C++ doesn’t require specific size for integers, Java does l Floating-point numbers have an IEEE standard, required because it’s more expensive to do arithmetic with than with 2

A Computer Science Tapestry 1.12 Alan Turing ( ) l Instrumental in breaking codes during WW II l Developed mathematical model of a computer called a Turing Machine (before computers)  solves same problems as a Pentium III (more slowly) l Church-Turing thesis  All “computers” can solve the same problems l Showed there are problems that cannot be solved by a computer l Both a hero and a scientist/ mathematician, but lived in an era hard for gay people

A Computer Science Tapestry 1.13 Complexity: What’s hard, what’s easy? l What is a prime number?  2, 3, 5, 7, 11, 13, …  Largest prime? l l How do we determine if these numbers are prime?  Test 3, 5, 7, …  If we can test one million numbers a second, how long to check a 100 digit #? l Why do we care? is not prime, I can prove it but I can’t give you the factors. l Finding factors is “hard”, determining primality is “easy”  What does this mean?  Why do we care? l Encryption depends on this relationship, without encryption and secure web transactions where would we be?

A Computer Science Tapestry 1.14 C.A.R. (Tony) Hoare (b. 1934) l Won Turing award in 1980 l Invented quicksort, but didn’t see how simple it was to program recursively l Developed mechanism and theory for concurrent processing l In Turing Award speech used “Emporer’s New Clothes” as metaphor for current fads in programming “ Beginning students don’t know how to do top-down design because they don’t know which end is up ”

A Computer Science Tapestry 1.15 Creating a Program l Specify the problem  remove ambiguities  identify constraints l Develop algorithms, design classes, design software architecture l Implement program  revisit design  test, code, debug  revisit design l Documentation, testing, maintenance of program l From ideas to electrons

A Computer Science Tapestry 1.16 From High- to Low-level languages l C++ is a multi-purpose language  Scheme - functional language  Java, Smalltalk- everything is object oriented l Compilers translate C++ to a machine-specific executable program  The compiler is a program, input is C++, output is an executable  What language is the compiler written in?  In theory C++ source code works on any machine given a compiler for the machine l C++ and other programming language are more syntactically rigid than English and other natural languages

A Computer Science Tapestry 1.17 Levels of Programming Language l Machine specific assembly language, Sparc on left, Pentium on right, both generated from the same C++ main: save %sp,-128,%sp pushl %ebp mov 7,%o0 movl %esp,%ebp st %o0,[%fp-20] subl $12,%esp mov 12,%o0 movl $7,-4(%ebp) st %o0,[%fp-24] movl $12,-8(%ebp) ld [%fp-20],%o0 movl -4(%ebp),%eax ld [%fp-24],%o1 imull -8(%ebp),%eax call.umul,0 movl %eax,-12(%ebp) nop xorl %eax,%eax st %o0,[%fp-28] jmp.L1 mov 0,%i0.align 4 b.LL1 xorl %eax,%eax nop jmp.L1

A Computer Science Tapestry 1.18 Alternatives to compilation l Some languages are interpreted, Scheme and Java are examples  like simultaneous translation instead of translation of written document. The same word may be translated many times  The interpreter is a program that translates one part of a source code at a time The interpreter is machine specific, written in some programming language l JVM, the Java Virtual Machine  Like a PC or Mac but machine is virtual, written in software  Executes Java byte codes which are created from Java source Like assembly language: between source code and executable  JVM must be written for each architecture, e.g., Linux, Windows, Mac, BeOS,...

A Computer Science Tapestry 1.19 What is a computer? l Turing machine: invented by Alan Turing in 1936 as a theoretical model infinite tape, moving tape-reader 0 1 Mainframe, PC,laptop, supercomputer A computer is a computer, is a computer, Church-Turing Thesis, all have same “power”

A Computer Science Tapestry 1.20 Why is programming fun? What delights may its practitioner expect as a reward? First is the sheer joy of making things Second is the pleasure of making things that are useful Third is the fascination of fashioning complex puzzle-like objects of interlocking moving parts Fourth is the joy of always learning Finally, there is the delight of working in such a tractable medium. The programmer, like the poet, works only slightly removed from pure thought- stuff. Fred Brooks