For Next Time
- Submit MP3 code, reflection, and slide (note the “Live presentation line” in slide deck)
- Reading Journal 13, with a focus on git style and version control tips in preparation of working with partners on MP4. Practicing sound Git habits are important as you first start working with a partner. Discuss some team ground rules and expectations, including version control practices.
- MP3 check-ins with teaching team
- Getting Going - classes and inheritance with scaffolding
- Going Beyond - encapsulation - classes from scratch
- Optional - exceptions and assertions
- studio time
From 11:00 - 12:30, one instructor and one course assistant will talk with each student in studio for about ~5 minutes. You will each have a time slot.
For the first 10 minutes of class, read through the getting going activity on classes and inheritance. We prepared this instead of doing a classwide lecture on the topics. Look at the set of questions at the bottom of the page. We will ask you some of the questions at the start of our check-in with you. From there, we can work together, 1 on 1, to firm up your understanding of concepts related to classes and inheritance. If we determine that the understanding is in place at the start of the check-in, we will explain how doing the Going Beyond encapsulation exercise will help you design better classes for MP3. We spend the remaining time helping you plan the best route to finishing MP3 with minimal speed bumps.
Getting Going - classes and inheritance with scaffolding
Refer to the page with a classes case study on pairing up college students using classes. Read the questions at the bottom of the page. If you know the answers already, move on to the Going Beyond exercises below. To make sure that you have a sound understanding of the concepts, please read the page and bring questions to your check-in.
Going Beyond - encapsulation - classes from scratch
We are putting together new exercises to expose the power of encapsulation, with the goals of helping students to:
- Understand how bundling class variables and functions (encapsulation) in Python offers conceptual and performance benefits in software development.
- Understand how and why the range object in Python provides performance benefits over lists, despite having similar functionality.
- Practice implementing a Python class with no starter code.
Follow the instructions to get started. Bring questions you have from this exploration to your check-in, to discuss ways that your MP3 can improve.
Read about Exceptions and try some examples
Exercise: Examine your code for MP3 and identify places where errors are likely to occur - make a list and be specific. Common culprits include anywhere you take input from a user, from the web, a database, or the filesystem. Decide what types of exceptions should be raised in each case and how they should be handled. Try implementing at least one exception in your code.
Read about Assertions and try some examples
Exercise: Take 2-3 of your functions from MP3 (or a past miniproject) and make your assumptions explicit by adding assertions. There’s a bit of an art to using assertions - if you defensively try to account for every single thing that could go wrong you’ll wind up with an unreadable mountain of tests for a small amount of code. Try to aim for the most impactful checks - things most likely to go wrong/be misused, and those most likely to be difficult to debug if used incorrectly.