CS 106X – Programming Abstractions in C++ Cynthia Bailey Lee CS2 in C++ Peer Instruction Materials by Cynthia Bailey Lee is licensed under a Creative Commons.

Slides:



Advertisements
Similar presentations
CSE 20 – Discrete Mathematics Dr. Cynthia Bailey Lee Dr. Shachar Lovett Peer Instruction in Discrete Mathematics by Cynthia Leeis licensed under a Creative.
Advertisements

{ Learning Agreement Debs Wilson.  A Learning Agreement (LA) is an opportunity for you to reflect upon your goals for this course as well as your goals.
CSE 20 – Discrete Mathematics Dr. Cynthia Bailey Lee Dr. Shachar Lovett Peer Instruction in Discrete Mathematics by Cynthia Leeis licensed under a Creative.
Tutoring and Academic Support How to Gain the Most From Northern Michigan University’s Academic Support Services.
CS112: Course Overview George Mason University. Today’s topics Go over the syllabus Go over resources – Marmoset – Blackboard – Piazza – Textbook Highlight.
CS106X – Programming Abstractions in C++ Cynthia Bailey Lee CS2 in C++ Peer Instruction Materials by Cynthia Bailey Lee is licensed under a Creative Commons.
CS106X – Programming Abstractions in C++ Cynthia Bailey Lee CS2 in C++ Peer Instruction Materials by Cynthia Bailey Lee is licensed under a Creative Commons.
Understanding Networked Applications: A First Course Introduction to course by David G. Messerschmitt.
Intro to CIT 594
June 13, Introduction to CS II Data Structures Hongwei Xi Comp. Sci. Dept. Boston University.
Welcome to IIT and cs105!. CS Secs Jon Hanrath SB Office Hours: –MW 8:00 A.M. – 9:45 A.M. –W 5:00 P.M. – 6:00 P.M
COURSE REDESIGN MANAGERIAL FINANCE Dr. Shannon Donovan, Professor, Accounting and Finance, Bridgewater State University
1 Learning Statistics Your goals and beliefs about learning statistics are directly related to your grade in STT 215.
Intro to CIT 594
CS211: Course Overview George Mason University. Today’s topics Go over the syllabus Go over resources – Marmoset – Piazza – Textbook Highlight important.
CS106X – Programming Abstractions in C++ Cynthia Bailey Lee CS2 in C++ Peer Instruction Materials by Cynthia Bailey Lee is licensed under a Creative Commons.
Is the Flipped Classroom Appropriate at the University Level? Thomas J Francl, MBA, CMA National University April 10, 2014.
Succeeding in the American Classroom Aimee Nord Office of International Programs.
Wimba Voice Critical to Successful Online Speech Language Pathology Assistant Courses Amy Heck, MA CCC-SLP Program Director Kari Watson, MA CCC-SLP Adjunct.
DISCUSS ACADEMIC achievement WITH YOUR PROFESSOR! Exercise your responsibility to discuss your academic performance with all your instructors Designed.
CS 106X – Programming Abstractions in C++ Cynthia Bailey Lee CS2 in C++ Peer Instruction Materials by Cynthia Bailey Lee is licensed under a Creative Commons.
Matthew Gilmore and Andrew Goodliffe July Interactive lectures: Classes in which the instructor breaks the lecture at least once per class to have.
Financial Accounting Business 112 Introduction (To Start, select Slide Show, then View Show. Advance slide and topics within slide by mouse click)
How to Learn in This Course CS 5010 Program Design Paradigms “Bootcamp” Lesson 0.1 © Mitchell Wand, This work is licensed under a Creative Commons.
20 Ways to Succeed in College 1. Go to class... and participate. Professors test on what is discussed in class as well as grade for attendance and participation.
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett.
CSE 12 – Basic Data Structures Cynthia Bailey Lee Some slides and figures adapted from Paul Kube’s CSE 12 CS2 in Java Peer Instruction Materials by Cynthia.
CS106X – Programming Abstractions in C++ Cynthia Bailey Lee CS2 in C++ Peer Instruction Materials by Cynthia Bailey Lee is licensed under a Creative Commons.
Programming Abstractions in C++ Cynthia Lee CS106X.
CS 106X – Programming Abstractions in C++ Cynthia Bailey Lee CS2 in C++ Peer Instruction Materials by Cynthia Bailey Lee is licensed under a Creative Commons.
Peer Instruction: Best Practices Leo Porter Cynthia Bailey Lee.
CSE 12 – Basic Data Structures Cynthia Bailey Lee Some slides and figures adapted from Paul Kube’s CSE 12 CS2 in Java Peer Instruction Materials by Cynthia.
CS106X – Programming Abstractions in C++ Cynthia Bailey Lee CS2 in C++ Peer Instruction Materials by Cynthia Bailey Lee is licensed under a Creative Commons.
CPSC 121: Models of Computation Unit 0 Introduction George Tsiknis Based on slides by Patrice Belleville and Steve Wolfman.
CS106X – Programming Abstractions in C++ Cynthia Bailey Lee CS2 in C++ Peer Instruction Materials by Cynthia Bailey Lee is licensed under a Creative Commons.
CSE 12 – Basic Data Structures Cynthia Bailey Lee Some slides and figures adapted from Paul Kube’s CSE 12 CS2 in Java Peer Instruction Materials by Cynthia.
How to Learn in This Course CS 5010 Program Design Paradigms “Bootcamp” Lesson 0.1 © Mitchell Wand, This work is licensed under a Creative Commons.
 Attend all class sessions ON TIME!  You can’t know exactly what goes on in class unless you are there  Listening and participating in discussions.
CS106X – Programming Abstractions in C++ Cynthia Bailey Lee CS2 in C++ Peer Instruction Materials by Cynthia Bailey Lee is licensed under a Creative Commons.
Introduction to Programming in MATLAB Intro. MATLAB Peer Instruction Lecture Slides by Dr. Cynthia Lee, UCSD is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike.
CS 106X – Programming Abstractions in C++ Cynthia Bailey Lee CS2 in C++ Peer Instruction Materials by Cynthia Bailey Lee is licensed under a Creative Commons.
CS106X – Programming Abstractions in C++ Cynthia Bailey Lee CS2 in C++ Peer Instruction Materials by Cynthia Bailey Lee is licensed under a Creative Commons.
CS 106X – Programming Abstractions in C++ Cynthia Bailey Lee CS2 in C++ Peer Instruction Materials by Cynthia Bailey Lee is licensed under a Creative Commons.
CS 4620 Intelligent Systems. What we want to do today Course introductions Make sure you know the schedule for the next three weeks.
Thinking and Communicating in College Professor Haines Falmouth 301D (978)
Introduction Welcome to Class! Counseling 120 Counseling 120 College and Career Success.
Welcome to English Class Week Class 1 Topic: Introductions Professor Emory.
HIGH SCHOOL  Time is structured by others  Students will usually be told what their responsibilities are and corrected if their behavior is out of line.
CS112: Course Overview George Mason University. Today’s topics Go over the syllabus Go over resources – Marmoset – Blackboard – Piazza – Textbook Highlight.
Data Structures and Algorithms in Java AlaaEddin 2012.
Welcome to English 101. To Do List for Today: Go over syllabus Discuss turnitin accounts and course website Prepare for success in Eng 101 Discuss the.
CS106X – Programming Abstractions in C++ Cynthia Bailey Lee CS2 in C++ Peer Instruction Materials by Cynthia Bailey Lee is licensed under a Creative Commons.
#1 Make sense of problems and persevere in solving them How would you describe the problem in your own words? How would you describe what you are trying.
CS106X – Programming Abstractions in C++ Cynthia Bailey Lee CS2 in C++ Peer Instruction Materials by Cynthia Bailey Lee is licensed under a Creative Commons.
MS. NANCY HARRIS LECTURER, DEPARTMENT OF COMPUTER SCIENCE CS 149 – Programming Fundamentals (Accelerated)
1 Chapter Chapter 2 The Whole Numbers.
Programming Abstractions
CSE 20: Discrete Mathematics for Computer Science Prof. Shachar Lovett
EE 312 Course Introduction
PATHWAYS 4 Listening, Speaking, and Critical Thinking
Data Structures Algorithms: (Slides to be Adopted from Goodrich and aligned with Weiss' book) Instructor: Ganesh Ramakrishnan
COSC051: Computer Science I
Programming Abstractions
Programming Abstractions
Intro to CIT 594
EE422C Software Design and Implementation II
Tips for Success in Mathematics
Problem-Based Learning by floating facilitation
How to be a successful college student
Presentation transcript:

CS 106X – Programming Abstractions in C++ Cynthia Bailey Lee CS2 in C++ Peer Instruction Materials by Cynthia Bailey Lee is licensed under a Creative Commons Attribution-NonCommercial- ShareAlike 4.0 International License. Permissions beyond the scope of this license may be available at Bailey LeeCreative Commons Attribution-NonCommercial- ShareAlike 4.0 International Licensehttp://peerinstruction4cs.org

Today’s Topics 1. Course structure and procedures:  Your Grade  My role  Your role 2. What is this class? What do we mean by “abstractions”? Next lecture:  Introduce the C++ language from the Java programmer’s perspective  (But it’s ok if you are not a Java programmer) 2

The Basics: Your Grade  4% Class participation  4% Section participation  20% Midterm  30% Final  42% Programming assignments (6% each) 3

What do I do in class?  Think of me as your tutor  That means that what I do is:  Be your guide in inducing you to explore concepts  Create situations and pose puzzles that set the scene for your exploration  Answer your questions  Not spend lecture reading the textbook to you with slightly different words 4

What do you do in class? (Before class, you prepare yourself by reading the textbook/handouts) 1. I ask a question 5

What do you do in class? (Before class, you prepare yourself by reading the textbook/handouts) 1. I ask a question 2. You first answer it by yourself 6

What do you do in class? (Before class, you prepare yourself by reading the textbook/handouts) 1. I ask a question 2. You first answer it by yourself 3. Then discuss in assigned groups of 3-4 students  Like a jury, you must come to a unanimous decision  Answer the question a second time 7

What do you do in class? (Before class, you prepare yourself by reading the textbook/handouts) 1. I ask a question 2. You first answer it by yourself 3. Then discuss in assigned groups of 3-4 students  Like a jury, you must come to a unanimous decision  Answer the question a second time 4. I will ask groups to share their insights, and I will provide additional clarification as needed 8

FAQ: “But Professor Lee, wouldn’t it be more efficient if you just taught us the right answer to begin with?”  Have you ever heard of an aerobics class where the instructor did all the exercises at the front of class, while the class just watched attentively?  Me neither.  To learn, you must do the work with your own muscle (your brain). 9

What do you do in this course?  Prepare for maximum in-class learning  Reading, reading quizzes  In class: engage with your neighbors and the class, engage with the ideas  Turn them upside down and sideways, think about what common errors or misconceptions might be  Seek help  In class, section, Piazza forum, TA office hours, instructor office hours, LaIR 10

Who should you be in this course?  Be a professional  Take the time to truly learn and transform yourself into a professional, not “cram” or work for points  Be warm and generous  Be invested in the progress and well-being of your classmates  Be earnest  Let your participation to be characterized by risk-taking and a headlong dive into the activity. Free yourself of the need to withhold part of yourself or remain aloof.  Be honest  Decide today to follow a path of uncompromised integrity in your work in this course and throughout your Stanford career. Envision yourself in the future with the confidence that can only be purchased with a long record of scrupulous decision-making. 11

About the textbook  Required textbook:  Programming Abstractions in C++ by Eric Roberts  Prof. Roberts is a faculty member here at Stanford  Note: do not buy C version

What is this class about? What do we mean by “abstractions”?

Sentence SubjectVerb PhraseObject CS106X AdverbVerb Possessive Noun totallyrocksmysocks Noun

CS106Xtotallyrocksmysocks

Building a vocabulary of abstractions makes it possible to represent and solve a huge variety of problems using known tools.

A first C++ program (ERROR) #include #include "console.h" using namespace std; int main(){ cout << "|-5| = " << absoluteValue(-5) << endl; return 0; } int absoluteValue(int n) { if (n<0){ return -n; } return n; } 19 firstprogram.cpp

A first C++ program (FIXED 1) #include #include "console.h" using namespace std; int absoluteValue(int n) { if (n<0){ return -n; } return n; } int main(){ cout << "|-5| = " << absoluteValue(-5) << endl; return 0; } 20 firstprogram.cpp

A first C++ program (FIXED 2) #include #include "console.h" using namespace std; int absoluteValue(int n); int main(){ cout << "|-5| = " << absoluteValue(-5) << endl; return 0; } int absoluteValue(int n) { if (n<0){ return -n; } return n; } 21 firstprogram.cpp

Question: Why does C++ have the function prototype syntax?  In other words, why not just have a rule that you must set up the ordering so you define your functions before using them, as in the “FIXED 1” example? A. C++ could have done that, but such a rule would be cumbersome. B. C++ could have done that, but good programming practice dictates “top-down” approach that logically puts main() first and helper functions it calls to follow. C. C++ couldn’t have done that—sometimes there is no way to order the functions so that all functions are defined before being used. D. All/none/more than one of the above

Question: Why does C++ have the function prototype syntax?  The rationales behind choices (A) and (B) (previous slide) are correct  May or may not have been enough to compel the language designers to introduce the function prototype feature  (C) is true—there are cases where you simply cannot rearrange the ordering of functions to avoid all cases of use before definition  e.g., mutual recursion

Mutual recursion #include #include "simpio.h" #include "console.h" using namespace std; void go(int n); void stanford(int n); int main(){ int n = getInteger("Enter a number of times to repeat: "); go(n); return 0; } void go(int n) { if (n == 0) return; cout << "Go!" << endl; stanford(n-1); } void stanford(int n) { cout << "Stanford!" << endl; go(n); }