15 July 00Bentley: FYI1 Truth, Beauty and Engineering: What I'd Like My CS Freshman Kid to Learn Next Year Jon Bentley Bell Labs www.programmingpearls.com/fyi.html.

Slides:



Advertisements
Similar presentations
Chapter 10 Input/Output Streams
Advertisements

Foundations of Programming and Problem Solving Introduction.
Modern Programming Languages, 2nd ed.
Hash Tables and Sets Lecture 3. Sets A set is simply a collection of elements Unlike lists, elements are not ordered Very abstract, general concept with.
Executional Architecture
© 2006 Pearson Addison-Wesley. All rights reserved10 A-1 Chapter 10 Algorithm Efficiency and Sorting.
1 Arrays and Strings Chapter 9 2 "All students to receive arrays!" reports Dr. Austin. Declaring arrays scores :
Standards Alignment A study of alignment between state standards and the ACM K-12 Curriculum.
1 CS101 Introduction to Computing Lecture 17 Algorithms II.
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Lecture 1: Overview of Computers & Programming
Lecture Roger Sutton 21: Revision 1.
COSC 120 Computer Programming
Lecture 2: Fundamental Concepts
1 Lecture 1: Course Overview Course: CSE 360 Instructor: Dr. Eric Torng TA: Huamin Chen.
Course Overview CS221 – Advanced Programming Fall 2007 : Ray S. Babcock Computer Science Department Montana State University.
Computer Science 1620 Programming & Problem Solving.
Chapter 8: I/O Streams and Data Files. In this chapter, you will learn about: – I/O file stream objects and functions – Reading and writing character-based.
Lecture Notes 8/30/05 Program Design & Intro to Algorithms.
HORSEED International University
Copyright 2003 Scott/Jones Publishing Brief Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
CSE 131 Computer Science 1 Module 1: (basics of Java)
TEACHING PROGRAMMING BY ITERATIVE DEEPENING Dr. Mark Lee | School of Computer Science, University of Birmingham
CS102 Introduction to Computer Programming
Introduction to Programming G50PRO University of Nottingham Unit 1 : Introduction Paul Tennent
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
Why Program? Computer – programmable machine designed to follow instructions Program – instructions in computer memory to make it do something Programmer.
Chapter Introduction to Computers and Programming 1.
Introduction CSE 1310 – Introduction to Computers and Programming
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
Week 2 CS 361: Advanced Data Structures and Algorithms
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming 1.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
A Computer Science Tapestry 1 Recursion (Tapestry 10.1, 10.3) l Recursion is an indispensable technique in a programming language ä Allows many complex.
Introduction CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
ITS REAL Teaching Students Today for the Future. What’s Up with These Kids?  Dress differently  Talk differently  Act differently  Think differently.
Computer Programming Basics Assistant Professor Jeon, Seokhee Assistant Professor Department of Computer Engineering, Kyung Hee University, Korea.
Tricks of the Programming Trade Jon Bentley Bell Labs
Goals of Course Introduction to the programming language C Learn how to program Learn ‘good’ programming practices.
Media Computing Instructor Byung Kim Olsen 231 Office hours – MWF 9:00-10:00 AM or by appointment.
COPYRIGHT © 2011 ALCATEL-LUCENT. ALL RIGHTS RESERVED. 1.
Arrays ELEC 206 Computer Applications for Electrical Engineers Dr. Ron Hayne.
Introduction CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
UNIT - 1Topic - 3. Computer software is a program that tells a computer what to do. Computer software, or just software, is any set of machine-readable.
CS 114 – Class 02 Topics  Computer programs  Using the compiler Assignments  Read pages for Thursday.  We will go to the lab on Thursday.
Korea Advanced Institute of Science and Technology, Dept. of EECS, Div. of CS, Information Systems Lab. 1/10 CS204 Course Overview Prof.
Jump to first page (c) 1999, A. Lakhotia 1 Software engineering? Arun Lakhotia University of Louisiana at Lafayette Po Box Lafayette, LA 70504, USA.
© 2011 Pearson Addison-Wesley. All rights reserved 10 A-1 Chapter 10 Algorithm Efficiency and Sorting.
King Saud University College of applied studies and community services CSC 1101 Computer Programming I Lecture 2.
File I/O ifstreams and ofstreams Sections 11.1 &
Basic of Programming Language Skill Area Computer System Computer Program Programming Language Programmer Translators.
File I/O 1 ifstreams and ofstreams Sections 11.1 & 11.2.
1 Ch. 1: Software Development (Read) 5 Phases of Software Life Cycle: Problem Analysis and Specification Design Implementation (Coding) Testing, Execution.
CMP 131 Introduction to Computer Programming Violetta Cavalli-Sforza Week 3, Lecture 1.
CS161 Topic #16 1 Today in CS161 Lecture #16 Prepare for the Final Reviewing all Topics this term Variables If Statements Loops (do while, while, for)
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. Office Access 2003 Lab 2 Modifying a Table and Creating.
Two-Dimensional Arrays ELEC 206 Computer Applications for Electrical Engineers Dr. Ron Hayne.
ICT Presentation. Why teach ICT? ICT is essential in enhancing your child’s education It will play an important role in your child’s teenage and adult.
Introduction CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
Extra Recitations Wednesday 19:40-22:30 FENS L055 (tomorrow!) Friday 13:40-16:30 FENS L063 Friday 17: :30 FENS L045 Friday 19:40-22:30 FENS G032.
Course Aims This course will help you understand the latest technologies & how they work. You will lean how to develop computer programs to solve problems.
Artificial Intelligence, simulation and modelling.
CS Class 04 Topics  Selection statement – IF  Expressions  More practice writing simple C++ programs Announcements  Read pages for next.
INTRODUCTION TO COMPUTER PROGRAMMING(IT-303) Basics.
Announcements HW6 due this Wednesday
Introduction CSE 1310 – Introduction to Computers and Programming
TMC 1414 Introduction to Programming
Learning to Program in Python
Learning to Program in Python
Announcements HW6 due this Wednesday
Presentation transcript:

15 July 00Bentley: FYI1 Truth, Beauty and Engineering: What I'd Like My CS Freshman Kid to Learn Next Year Jon Bentley Bell Labs

15 July 00Bentley: FYI2 Context Main Course: Curriculum Design What content? Which courses? Which languages? This Talk: Desserts and Spices Little add-ons for first-year courses (Weave-throughs?)

15 July 00Bentley: FYI3 Outline Engineering Tricks of the Trade Eyes Open to the World Beauty Elegance Communication Truth History Ethics

15 July 00Bentley: FYI4 A Quiz A TV Commercial U.S. college students eat 60 million slices of pizza per month. Is this reasonable? How much does a one-hour lecture cost? A program sorts one million integers in one second. How long to sort two million? How long will an exhaustive search take to solve a TSP of size 10? 20? 30? How much do calculus texts cost?

15 July 00Bentley: FYI5 The Back of the Envelope Important for engineers and citizens How to teach quick calculations? Probably not a lecture (nor even half an hour) Woven throughout an education What to teach Tabular computations Rules of thumb Quick checks Safety factors

15 July 00Bentley: FYI6 Problem Definition For 72 psychological subjects, randomly permute order of experimenters (1, 2, 3) stress conditions (High, Medium, Low) Desired results 1 3L 2M 1H 2 3H 1M 2L 3 1L 2H 3M 4 1M 2L 3H … How to generate?

15 July 00Bentley: FYI7 An Elegant Solution Educational Goals Knowledge about how to solve a problem Wisdom about what problem to solve LMH MLH LHM

15 July 00Bentley: FYI8 Debugging Tales A banking system quits on international data. The programmer cant log in standing up. A program works once twice.

15 July 00Bentley: FYI9 Engineering Tricks of the Trade Back of the Envelope Estimates Problem Definition Debugging Tradeoffs, Symmetry Components, Prototypes Simplicity, Elegance programmingpearls.com/tricks.html

15 July 00Bentley: FYI10Bentley: FYI Engineers Eyes How does that CD player work? Random play: algorithm? RNG? How much music? Compared to MP3? Error correction? Scratches? Bounces? Textual description of content? Remote control? Store state at power off? Representation? Navigation over a long spiral?

15 July 00Bentley: FYI11Bentley: FYI Real-World Software Your Watch Automobiles Entry systems: Keys, combinations, remote Antilock brakes, carburetors, transmissions, … Memory for user preferences GPS, maps, radar, HUDs, … Count the processors! Networks? Entry Systems Dorms, cars, arenas, turnpikes, hotel rooms, … Sound, Pictures, Motion Pictures

15 July 00Bentley: FYI12Bentley: FYI Some Wonderful Books Adams, Conceptual Blockbusting Petroski, To Engineer Is Human Polya, How To Solve It Strunk and White, Elements of Style Huff, How to Lie with Statistics Fisher and Ury, Getting to Yes

15 July 00Bentley: FYI Outline Engineering Beauty Elegance Communication Truth

15 July 00Bentley: FYI Elegance Gordon Bell: The cheapest, fastest and most reliable components are those that arent there. Antoine de Saint Exupéry: A designer knows he has arrived at perfection not when there is no longer anything to add, but when there is no longer anything to take away. Albert Einstein: Everything should be made as simple as possible, but no simpler.

15 July 00Bentley: FYI A C++ Program // count # occurrences of all characters in a file // written: 8/5/94, Owen Astrachan, modified 5/1/99 void Print(const tvector & counts, int total); void Count(istream & input, tvector & counts, int & total); int main() { int totalAlph = 0; string filename = PromptString("enter name of input file: "); ifstream input(filename.c_str()); if (input.fail() ) { cout << "could not open file " << filename << endl; exit(1); } tvector charCounts(CHAR_MAX+1,0); // all initialized to 0 Count(input,charCounts,totalAlph); Print(charCounts,totalAlph); return 0; } void Count(istream & input, tvector & counts, int & total) // precondition: input open for reading // counts[k] == 0, 0 <= k < CHAR_MAX // postcondition: counts[k] = # occurrences of character k // total = # alphabetic characters { char ch; while (input.get(ch)) // read a character { if (isalpha(ch)) // is alphabetic (a-z)? { total++; } ch = tolower(ch); // convert to lower case counts[ch]++; // count all characters } void Print(const tvector & counts, int total) // precondition: total = total of all entries in counts['a']..counts['z'] // postcondition: all values of counts from 'a' to 'z' printed { const int MIDALPH = 13; cout.setf(ios::fixed); // print 1 decimal place cout.precision(1); char k; for(k = 'a'; k <= 'm'; k++) { cout << k << setw(7) << counts[k] << " "; cout << setw(4) << 100 * double(counts[k])/total << "% \t\t"; cout << char(k+MIDALPH) << setw(7) << counts[k+MIDALPH] << " "; cout << setw(4) << 100 * double(counts[k+MIDALPH])/total << "%" << endl; }

15 July 00Bentley: FYI A Longer Program Roberts, The Art and Science of C ( A-W, 1995 ) 3 1/2 pages Functions: main, CountLetters, CountLettersInString, RecordLetter, DisplayLetterCounts, LetterIndex, ClearIntegerArray

15 July 00Bentley: FYI Kernighan and Pikes Program unsigned long count[UCHAR_MAX+1]; /* freq main: display byte frequency counts */ int main(void) { int c; while ((c = getchar()) != EOF) count[c]++; for (c = 0; c <= UCHAR_MAX; c++) if (count[c] != 0) printf("%.2x %c %lu\n", c, isprint(c) ? c : '-', count[c]); return 0; }

15 July 00Bentley: FYI Elegant Sorts void isort(int *a, unsigned n) { int i, j; for (i = 1; i < n; i++) for (j = i; j > 0 && a[j-1] > a[j]; j--) swap(j, j-1, a); } void qsort(int *a, unsigned n) { int i, j; if (n <= 1) return; for (i = 1, j = 0; i < n; i++) if (a[i] < a[0]) swap(++j, i, a); swap(0, j, a); qsort(a, j); qsort(a+j+1, n-j-1); }

15 July 00Bentley: FYI Strunk and Whites Rule 17 Vigorous writing is concise. A sentence should contain no unnecessary words, a paragraph no unnecessary sentences, for the same reason that a drawing should have no unnecessary lines and a machine no unnecessary parts. This requires not that the writer make all sentences short, or avoid all detail and treat subjects only in outline, but that every word tell.

15 July 00Bentley: FYI Code in Programming Pearls Sorting unique integers Vector rotation Anagrams Maximum-sum subvector Binary search Insertion sort, quicksort, heapsort Random samples Heaps Longest duplicated substrings Markov text

15 July 00Bentley: FYI Communication Essential skill for all students Audience: Technical and nontechnical Writing and speaking How to teach it? Example: Lectures, handouts, web pages, … Practice Documentation Essays Term papers Oral presentations

15 July 00Bentley: FYI Outline Engineering Beauty Truth History Ethics

15 July 00Bentley: FYI Caching Ideally one would desire an indefinitely large memory capacity such that any particular [word] would be immediately available.… It does not seem possible to achieve such a capacity. We are therefore forced to recognize the possibility of constructing a hierarchy of memories, each of which has greater capacity than the preceding but which is less quickly accessible. Preliminary discussion of the logical design of an electronic computing instrument, Burks, Goldstine, von Neumann, 1946

15 July 00Bentley: FYI Kinds of History The Field The Human Side The 1990 house Organizational 1965: Triangle Universities Computation Center Personal My 32K computers: 1969, 1973, 1981, 1999 Artifacts Old computers, disks Strongs Exhaustive Concordance

15 July 00Bentley: FYI A Victorian Search Engine Strongs Exhaustive Concordance Sample Entry thankful See also UNTHANKFUL Ps 100:4 be t unto him, and bless his name. Ro 1:21 him not as God, neither were t; Col 3:15 called in one body; and be ye t. Compare to AltaVista /sites/talk/AltaVista_Technical-abs.html A Fun Programming Exercise

15 July 00Bentley: FYI History in Pearls 1950s Brookss Kentucky state income tax 1960s Anagrams; fast binary search 1970s Suffix arrays; Maximum-sum subarray Lesks touch-tone phone directory Kernighans symmetric matrices 1980s Data communication within Lockheed

15 July 00Bentley: FYI Ethics First-year Students When may they copy text and code? Why? Vary the rules! Social Issues: Napster? Ellisons spies? Older Students Growing a spelling list Snooping through files; reading mail College privacy: prox cards, web histories,... Real Problems Ethical questions that made me lose sleep

15 July 00Bentley: FYI A Whole World Cracking DVDs How do DVDs work? Mathematics, science, technology Back of the Envelope Bandwidth for sharing a DVD? History of movies and protection Ethics Concise Text and Code