CS61A Disc 3 Sections 13/26 Dickson Tsai No OH this week. Schedule appts at dicksontsai.com/meet 1.

Slides:



Advertisements
Similar presentations
We’ll be spending minutes talking about Quiz 1 that you’ll be taking at the next class session before you take the Gateway Quiz today.
Advertisements

CS61A Lecture 8 Data Abstraction Tom Magrino and Jon Kotker UC Berkeley EECS June 28, 2012.
No calculators or notes can be used on this quiz.
CSE 113 Introduction to Computer Programming Lecture slides for Week 10 Monday, October 31 th, 2011 Instructor: Scott Settembre.
Slide 1 CS61A Sections 13/26 Dickson Tsai dicksontsai.com/cs61a OH: M 4-5pm, Th 2-4pm Garbarini Lounge Discussion 0 Working.
Wednesday, 10/2/02, Slide #1 CS 106 Intro to CS 1 Wednesday, 10/2/02  QUESTIONS (on HW02 – due at 5 pm)??  Today:  Review of parameters  Introduction.
Policies and Procedures
Data Abstraction… The truth comes out…. What we’re doing today… Abstraction ADT: Dotted Pair ADT: List Box and Pointer List Recursion Deep List Recursion.
Using MyMathLab Features You must already be registered or enrolled in a current MyMathLab class in order to use MyMathLab. If you are not registered or.
Today’s quiz on 8.2 B Graphing Worksheet 2 will be given at the end of class. You will have 12 minutes to complete this quiz, which will consist of one.
CSSE221: Software Dev. Honors Day 17 Announcements Announcements Fifteen and CarsTrucksTrains coming back Fifteen and CarsTrucksTrains coming back Note:
Please open your laptops, log in to the MyMathLab course web site, and open Daily Quiz 18. You will have 10 minutes for today’s quiz. The second problem.
Math 010 online work that was due today at the start of class:
Make sure you know the day and time of the final exam for this section of Math 110: Day: ______ Date:______ Time: ______ to _______ All Math 110 finals.
Physics 215–Elementary Modern Physics Everyone Pick Up: Syllabus Student Info sheet – fill it out 8/27
Next class session: Test 1 on all sections covered from Chapters 1 and 2 Remember: If you haven’t yet passed the Gateway Quiz, you need to review your.
CS1101: Programming Methodology Aaron Tan.
CS61A Lecture 2 Functions and Applicative Model of Computation Tom Magrino and Jon Kotker UC Berkeley EECS June 19, 2012.
Please CLOSE YOUR LAPTOPS, and turn off and put away your cell phones, and get out your note-taking materials. Today’s daily quiz will be given at the.
Welcome to CS 115! Introduction to Programming. Class URL Please write this down!
1 Programming James King 12 August Aims Give overview of concepts addressed in Web based programming module Teach you enough Java to write simple.
Any questions on today’s homework? (Sections 1.6/1.7) Reminder: You should be doing this homework without using a calculator, because calculators can’t.
7-Sep-15 Physics 1 (Garcia) SJSU Conceptual Physics (Physics 1) Prof. Alejandro Garcia Spring 2007.
Please open Daily Quiz 34. A scientific calculator may be used on this quiz. You can keep your yellow formula sheets out when you take the quiz. Remember.
Peter Andreae Computer Science Victoria University of Wellington Copyright: Peter Andreae, Victoria University of Wellington Summary and Exam COMP 102.
Design IS 101Y/CMSC 101 Computational Thinking and Design Tuesday, October 15, 2013 Carolyn Seaman University of Maryland, Baltimore County.
Computer Science 10: Introduction to Computer Science Dr. Natalie Linnell with credit to Cay Horstmann and Marty Stepp.
1 Project Information and Acceptance Testing Integrating Your Code Final Code Submission Acceptance Testing Other Advice and Reminders.
CS 241 – Computer Programming II Lab Kalpa Gunaratna –
CSE 113 Introduction to Computer Programming Lecture slides for Week 5 Monday, September 26 th, 2011 Instructor: Scott Settembre.
Trees! =) Write up-add tree which behaves in this manner: 1 31 / \ / \ 3 5  21 9 / | \ \ / | \ \
Welcome to CS 115! Introduction to Programming. Class URL Write this down!
Session 4: PREPARE FOR TESTS Year 7 Life Skills Student Wall Planner and Study Guide.
Please CLOSE YOUR LAPTOPS, and turn off and put away your cell phones, and get out your note- taking materials.
ADTs and C++ Classes Classes and Members Constructors The header file and the implementation file Classes and Parameters Operator Overloading.
1 CS Tutorial 5 Frid. Oct 23, 2009 Design Document Tutorial.
Making Python Pretty!. How to Use This Presentation… Download a copy of this presentation to your ‘Computing’ folder. Follow the code examples, and put.
Welcome to CS61A Disc. 29/47 :D Dickson Tsai OH: Tu, Th 4-5pm 411 Soda Previous stop: None >>> Today: Working effectively in.
1 CS161 Introduction to Computer Science Topic #9.
Please CLOSE YOUR LAPTOPS, and turn off and put away your cell phones, and get out your note- taking materials.
1 Welcome Alireza Moghaddam Humber College Lecture 1 Game 540 Alireza Moghaddam
Distance Learning Quiz. Is Distance Learning For Me? Let this short quiz help you decide. For each question, choose one answer. Scoring instructions will.
The Beauty and Joy of Computing Lecture #6 Algorithms I UC Berkeley EECS Sr Lecturer SOE Dan Garcia.
Fall 2008Programming Development Techniques 1 Topic 5 Data Abstraction Note: This represents a change in order. We are skipping to chapter 2 without finishing.
Any questions on today’s homework? (Sections 1.6/1.7) Reminder: You should be doing this homework without using a calculator, because calculators can’t.
1 Programming 2 Aims Give overview of concepts addressed in Web based programming module Teach you enough Java to write simple web and network applications.
1 Printing in Python Every program needs to do some output This is usually to the screen (shell window) Later we’ll see graphics windows and external files.
CMSC 2021 CMSC 202 Computer Science II for Majors Spring 2002 Sections Ms. Susan Mitchell.
Data Design and Implementation. Definitions Atomic or primitive type A data type whose elements are single, non-decomposable data items Composite type.
REMINDER: If you haven’t yet passed the Gateway Quiz, make sure you take it this week! (You can find more practice quizzes online in the Gateway Info menu.
Math 010 online work that was due today at the start of class: Section 1.3A Online Homework.
We’ll be spending a few minutes talking about Quiz 2 on Sections that you’ll be taking the next class session, before you work on Practice Quiz.
מבוא מורחב שיעור 7 1 Lecture 7 Data Abstraction. Pairs and Lists. (Sections – 2.2.1)
Teachers: If you hand back Test 4 today, tell your class you will review it with them in class on Thursday when you do the review lecture on Chapters 6,
REMINDER: If you haven’t yet passed the Gateway Quiz, make sure you take it this week! (You can find more practice quizzes online in the Gateway Info menu.
1 1.Log in to the computer in front of you –Temp account: 210class / 2.Update your in Cascadia's system –If I need to you I'll use.
CSC 1010 Programming for All Lecture 5 Functions Some material based on material from Marty Stepp, Instructor, University of Washington.
Chapter 3 Lists, Stacks, Queues. Abstract Data Types A set of items – Just items, not data types, nothing related to programming code A set of operations.
CSC207 Fall 2016.
CS170 – Week 1 Lecture 3: Foundation Ismail abumuhfouz.
Pairs and Lists. Data Abstraction. SICP: Sections – 2.2.1
We’ll be spending minutes talking about Quiz 1 that you’ll be taking at the next class session before you take the Gateway Quiz today.
Facebook Cover Photo Trick
Welcome to CS 1010! Algorithmic Problem Solving.
Module 5: Data Cleaning and Building Reports
Lecture #6 section pages pages72-77
Programming We have seen various examples of programming languages
Lecture #6 section pages pages72-77
Today’s topics Abstractions Procedural Data
Presentation transcript:

CS61A Disc 3 Sections 13/26 Dickson Tsai No OH this week. Schedule appts at dicksontsai.com/meet 1

 The secret word is “datarep”  Please fill out a survey at dicksontsai.com/attendance with thesecret word  Deadline is next discussion 2 Attendance Logistics

1.How can I make your lab/discussion experience more worthwhile? 2.What is an object? Think of a real life example. 1.Hint: They consist of _______ and ______, bundled together to create _______ 3.An abstract data type (ADT) allows us to treat ________ as units. Think of a real life example. 4.What is data abstraction? Think of a real life example. 1.Hint: A methodology by which functions enforce an __________ between r________ and u___ 3 Section Quiz

1.What is an object? Think of a real life example. 1.Hint: They consist of data and behavior, bundled together to create abstractions 2.An abstract data type (ADT) allows us to treat compound objects (object that combines objects) as units. Think of a real life example. 3.What is data abstraction? Think of a real life example. 1.Hint: A methodology by which functions enforce an abstraction barrier between representation and use 4 Section Quiz [Solutions]

1.What is an object? Think of a real life example. 1.A car. Has properties (data) such as color, model, etc. Has behavior such as drive, brake, etc. 2.Abstract data type (ADT) Think of a real life example. 1.UC Berkeley is collection of classrooms, labs, faculty, etc. 2.‘University’ – institution for teaching, research 3.University rankings: manipulate univ. as single unit 5 Section Quiz [Solutions] Top Public Univ. 1.UC Berkeley 2.UCLA

1.What is data abstraction? Think of a real life example. 1.Real life example: You can play Sudoku anywhere! How’s that possible??? - The appearance may change, but the rules never change! 6 Section Quiz [Solutions]

 Midterm 1 is graded. Exams require practice!  HW3 due next Thursday.  Reminder: My OH are Tuesdays, Thursdays 4-5 PM in Soda 411  Guerrilla section on recursion will be held this Saturday. Remember, it’s a place where you can collaborate with people and do practice problems  Go to dicksontsai.com/meet to schedule an appointment if you want me to go over the midterm with you personally. 7 Anuncios

 5-10 minutes to talk about HW/Project/Q&A  More time for quiz?  I’ll make them easier/shorter b/c lots to cover  More examples and explain them  I have found that helpful as well – will do more easy ones  Discussion questions of different difficulty  You can work ahead! I usually skip questions.  Hit more difficult questions  Will attempt 1 difficult question/disc using rules  More analysis of writing code  Funny videos, CS in the news, practice midterm Q, educational vids  Allow food -> You can eat during discussion! Just clean up after yourselves.  More fill-in-the-blank questions to start with  More walkthrough of my approach 8 Your feedback

 Monday Midterm: 4b Section avg /4 9 5-min Review Recap def if_fn(cond): if cond: return lambda a, b: a else: return lambda a, b: b def factorial(n): def base(): return 1 def rec(): return n * factorial(n-1) return ______________ Remember that boolean operators are also operators! (e.g. >=, ==, …) Function boxes!!!!!!!!!! !

 Focus on your thought process, not the solutions!  When reviewing your midterm, don’t just memorize the solutions. We’re smart enough not to throw the same tricks at you.  Write as much as you can in a test!  Will help you remember more thoughts while you take the test.  Will help you determine what thought processes worked  If your answer is right… what worked?  If your answer is wrong…  What could you have done differently?  E.g. use function boxes, call expression trees next time 10 Tip of the Day

 Form groups of 2-3 as usual  Write up your solution (function boxes + answers) on the board!  If you are concerned about putting about an incorrect answer, you shouldn’t be. It’s better to make mistakes here than on the test.  Plus, everyone can see common mistakes and learn together.  More practice with writing code  Chalkboards should make you feel smart.  Rotate people every problem so everyone gets a chance. 11 New Way of Running Disc

 The general technique of isolating the parts of a program that deal with how data are represented from the parts that deal with how data are manipulated 12 Data Abstraction Representation – stored as 2x2 matrix here Class city Name Latitude Longitude City instance Madrid40N3W City instance Sydney33S151E

 You can do cool stuff, like define functions that take in cities, or make lists of cities, etc.  A city is now a new type, alongside built-in types like booleans, ints, floats, strs, functions, lists, etc. 13 Data Abstraction Use – don’t care about how data’s stored Class city Name Latitude Longitude City instance Madrid40N3W City instance distance Number value

 Another real life example (because examples help with learning). 14 Data Abstraction Use Representation Abstraction barrier: Non-disclosure agreement Facebook friend Mutual friends with me Date we first met Shared tagged photos Behavior: Add friend Behavior: Delete friend Facebook friend Id1= Id2= Shared photos computed by query (Not the actual representation. Just trying to get message across)

 Another real life example (because examples help with learning): file names 15 Data Abstraction – More Examples Use Representation Behavior conds: Style should be for header HTML beautiful_website.html Version color: #1340EE Version color: #24B6C2 Version color: #AA3451 header.css

 Did you know? Python files in your current directory can be imported as modules! 16 Data Abstraction – Python Use Representation Behavior conds: Style should be for header HTML life.py from constants import * print(“I made {0} slides for my section”.format(SLIDES)) print(“The {0} slides are made with care”.format(SLIDES)) constants.py SLIDES = 8 constants.py

 Then, for next lab: 17 Data Abstraction – Python Use Representation Behavior conds: Style should be for header HTML life.py from constants import * print(“I made {0} slides for my section”.format(SLIDES)) print(“The {0} slides are made with care”.format(SLIDES)) constants.py SLIDES = 9 constants.py Wow, I only had to change constants.py! I just use SLIDES without worrying about the actual count.

1.Representation: How will I store my data? 1.Choose a data structure! They can range from a simple list to a complicated class. 2.Not all values the user asks for has to be stored. They can sometimes be computed. 1.def get_distance(self, city2): 2.Constructors: What’s the interface available for me to make objects of a certain ADT? 3.Selectors: How to get info from an object of a certain ADT? 4.Working with the type: What functions can I use to manipulate objects of an ADT? Or should I write my own? 18 Data Abstraction Qs

1.Representation: How will I store my data? 1.A simple list suffices: [numer, denom]. Note: order is important here! 2.Constructors: What’s the interface available for me to make objects of a certain ADT? def make_rational(n, d):def make_rational(w): return [n, d] return [w, 1] 3.Selectors: How to get info from an object of a certain ADT? def numer(r):def denom(r): return r[0]return r[1] 4.Working with the type: What functions can I use to manipulate objects of an ADT? Or should I write my own? add_rationals(r1, r2)mul_rationals(r1, r2)reciprocal(r1) 19 Data Abstraction Qs Example Rational: numerator / denominator

 E.g. states in AI search problem  Each state is a combination of information (game board, where the agents are, etc.)  They are treated as a unit when passed into functions expecting state- types.  E.g. heuristic functions take in a state and returns a value for that state.  E.g. synchronization primitives (locks, semaphores) in operating systems  Very low level: disabling interrupts  However, having to implement that all the time is tedious! We want a type of object that has that desired behavior. 20 Application of Data Abstraction from my classes

 Given this selector function, implement the corresponding constructor of the object.  Use this type’s interface to create a function that manipulates this type.  How do we represent the unit ADT using the Pair ADT?  Related question: how do we use the Pair ADT (holds 2 objects) to create a list of any length?  There are so many questions to explore! Try working on programs to practice data abstraction!  Reminder to finish discussion packets at home. 21 Sample Data Abstraction Problems

1.What are advantages of object-oriented programming syntax? 2.What is the type of an object called? 1.[Experienced programmers:] Can you consider the ____ an object as well? 3.What functions do we need to define an ADT and therefore create data abstraction? Con______ and sel______. 4.What 2 objects does the rational ADT combine? 1.What does the con_______ look like? Give the domain and range. 2.What do the sel______ look like? Give the domain and range. 5.How do you describe the domain/range of add_rationals(x, y)? 6.Why is it that divide_rational = lambda x, y: [x[0]*y[0], x[1]*y[1]] violates the abstraction barrier set up by the rational constructors/selectors? 7.What are behavior conditions for ADTs? Why can (and should we) recognize ADTs by their behavior, not by their class? 22 Optional Conceptual Questions (Wednesday 2/11 lecture)