Object-Oriented Python Cover

Object-Oriented Python

Master OOP by Building Games and GUIs
by Irv Kalb
December 2021, 416 pp.
ISBN-13: 
9781718502062
Lay-flat binding

Look Inside!

Object-Oriented Python backcover Object-Oriented Python book pages 94-95
Object-Oriented Python book pages 242-243Object-Oriented Python book pages 216-217

Download Chapter 2: MODELING PHYSICAL OBJECTS...

Click here to download the book's code and resources.
Click here to visit the book's github repository.

Object-Oriented Programming (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.

Author Bio 

Irv Kalb is an adjunct professor at UCSC-Extension and University of Silicon Valley (formerly Cogswell College), where he teaches introductory and object-oriented programming courses in Python. Kalb has a bachelor's and master's degree in Computer Science, decades of experience developing software while focusing on educational software, and has been teaching for over 10 years. He is the author of Learn to Program with Python 3: A Step-by-Step Guide to Programming (Apress).

Table of contents 

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
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

View the Copyright page
View the detailed Table of Contents
View the Index

Reviews 

"If only I could have learned programming with this book! Any sufficiently advanced Python code will work with classes and Irv Kalb has provided a useful, fun introduction to Object-Oriented Programming (OOP). The projects start simple and build upon each other, always with a specific outcome in mind. For example, the first example is a basic card game written in procedural Python. A dozen chapters later, you'll be including card graphics and keeping track of the state of the deck with OOP concepts like encapsulation, polymorphism, and inheritance—all without reading a dry textbook. Object-Oriented Python is a fun way for new coders to level up their skills."
— Adam DuVander, EveryDeveloper

"The projects for the most part are real world appropriate, and easily understandable for multiple levels of expertise of the readers . . . Anyone who is interested in learning Python Object Oriented Programming would benefit by having this book in their library. Kudos to both Mr. Kalb and No Starch Press for this book!"
—Full Circle Magazine

Updates 

View the latest errata.