objects, classes, inheritance, attributes, methods
Object-oriented programming is a way of modeling and designing your programs by bringing data and behavior together.
Consider using the apply first, study second approach with the resources below: try a problem or exercise from the Apply It section first. If you get stuck, then use a course, book, or lecture in the Reference section. Or if you’re completely new to a topic, then learn just enough and apply right away. The point is: the quicker you get to the “doing,” the better the learning. Make your learning active.
Reuven Lerner’s book, Python Workout, offers several problems to help bridge your understanding of objects and object-oriented programming (see chapter 9). I’ve mentioned this book in previous parts of the Pyramid, and it’s useful here, too, for many of the same reasons: it offers quality problems and detailed solutions, via the accompanying screencasts.
The problems are useful because they drill the fundamentals of objects and object-oriented programming. So if you feel a bit shaky with basics, then start here. Plus, as noted previously, the screencasts of the solutions are a point of distinction. They’re a great way to get into the mindset of an experienced programmer and sharpen your understanding of what you’re doing and why.
Tip: It’s one thing to solve a problem. It’s another thing entirely to learn from it and really understand what you wrote and why you wrote it. Taking time to look back and study your solution, as well as solutions of others, is time well-spent.
Take your knowledge of objects up a notch with this free Disc 07: Object-Oriented Programming problem set from Berkeley's CS 61A course. You can copy the code for each problem into your text editor. Then, start solving!
Another useful resource from CS 61A is Homework 5: Object-Oriented Programming, Linked Lists, Trees. For the purposes of this section of the Pyramid, just focus on the two questions related to objects and object-oriented programming: Q1: Vending Machine and Q2: Mint. Both are quality problems and tests are provided. This short video will show you how to access the files and run the tests for Homework 5.
Object-oriented Python by Reuven Lerner is a useful course to nail the basics of OOP, like methods, attributes, and inheritance. Lerner has a clear teaching style and he assumes very little. He anticipates questions you may have and proactively answers them in the provided video lectures.
"Success is not final, failure is not fatal: it is the courage to continue that counts."
9 steps to better software design today by Jeff Bay is a free PDF that’s filled with advice for writing sound object-oriented code.
For a deeper dive, then check out these free video lectures from Berkeley’s CS 61A course on Objects and Inheritance. These links contain a playlist of lectures. Use the apply first, study second approach and focus on the precise piece of information that you need. Then go back to your code and apply it. Or if text is your preferred format, then you may find section 2.5 in John DeNero’s electronic (and free!) book, Composing Programs, helpful.
99 Bottles of OOP by Sandi Metz is an electronic book that starts with solving the problem, “99 Bottles of Beer” (which you’re encouraged to solve before reading the book). Then, it dives into an extensive discussion of OOP principles and practices. Along the way, you’ll level up your skills with Test-Driven Development and refactoring, as well as the reasons for the refactoring.