Book description
Object-Oriented Python (OOP) is a paradigm that combines data and code into cohesive units, allowing you to think differently about computational problems and solve them in a highly reusable way. Aimed at intermediate-level programmers, Object-Oriented Python is a hands-on tutorial that goes deep into the core tenets of OOP, showing you how to use encapsulation, polymorphism, and inheritance to write games and apps using Python.
The book begins by demonstrating key problems inherent in procedural programming, then guides you through the basics of creating classes and objects in Python. You’ll build on this groundwork by developing buttons, text fields, and other GUI elements that are standard in event-driven environments. You’ll also use many real-world code examples and two pygame-based packages to help turn theory into practice, enabling you to easily write interactive games and applications complete with GUI widgets, animations, multiple scenes, and reusable game logic. In the final chapter, you’ll bring it all together by building a fully functional video game that incorporates many of the OOP techniques and GUI elements covered in the book.
You’ll learn how to:
•Create and manage multiple objects using an object manager object
•Use encapsulation to hide the inner details of objects from client code
•Use polymorphism to define one interface and implement it in multiple classes
•Apply inheritance to build on existing code
Object-Oriented Python is a visual, intuitive guide to fully understanding how OOP operates and how you can use it to make your code more maintainable, readable, and efficient—without sacrificing functionality.
Table of contents
- Title Page
- Copyright
- Dedication
- About the Author
- Acknowledgments
- Introduction
-
Part I: Introducing Object-oriented Programming
- Chapter 1: Procedural Python Examples
- Chapter 2: Modeling Physical Objects with Object-Oriented Programming
- Chapter 3: Mental Models of Objects and the Meaning of “self”
- Chapter 4: Managing Multiple Objects
-
Part II: Graphical User interfaces with Pygame
- Chapter 5: Introduction to Pygame
- Chapter 6: Object-Oriented Pygame
- Chapter 7: Pygame GUI Widgets
-
Part III: Encapsulation, Polymorphism, and Inheritance
- Chapter 8: Encapsulation
- Chapter 9: Polymorphism
-
Chapter 10: Inheritance
- Inheritance in Object-Oriented Programming
- Implementing Inheritance
- Employee and Manager Example
- The Client’s View of a Subclass
- Real-World Examples of Inheritance
- Multiple Classes Inheriting from the Same Base Class
- Abstract Classes and Methods
- How pygwidgets Uses Inheritance
- Class Hierarchy
- The Difficulty of Programming with Inheritance
- Summary
- Chapter 11: Managing Memory Used by Objects
-
Part IV: Using OOP in Game Development
- Chapter 12: Card Games
- Chapter 13: Timers
- Chapter 14: Animation
- Chapter 15: Scenes
- Chapter 16: Full Game: Dodger
- Chapter 17: Design Patterns and Wrap-Up
- Index
Product information
- Title: Object-Oriented Python
- Author(s):
- Release date: January 2022
- Publisher(s): No Starch Press
- ISBN: 9781718502062
You might also like
book
Mastering Object-Oriented Python - Second Edition
Gain comprehensive insights into programming practices, and code portability and reuse to build flexible and maintainable …
book
Robust Python
Does it seem like your Python projects are getting bigger and bigger? Are you feeling the …
book
Using Asyncio in Python
If you’re among the Python developers put off by asyncio’s complexity, it’s time to take another …
book
Python Object-Oriented Programming - Fourth Edition
A comprehensive guide to exploring modern Python through data structures, design patterns, and effective object-oriented techniques …