Object-Oriented Python
Written by Mike James   

Author: Irv Kalb
Publisher: No Starch Press
Date: January 2022
Pages: 416
ISBN: 978-1718502062
Print: 1718502060
Kindle: ‎ B0957SHYQL
Audience: Python developers
Rating: 3
Reviewer: Mike James
Python, Object-Oriented? Not a lot of programmers know that!

It is true that you can sit down and start to program using Python as if it was a scripting language with no thought of objects or orientation. This is a shame, but the phase soon passes. In most cases you cannot avoid learning about Python objects for the simple reason you have to use them before you get very far. This is an intermediate, but very very common, stage of development. Most programmers are consumers of objects rather than the creators of objects. In this blissful state a programmer can mostly avoid all of the fairly difficult and often controversial ideas of object-oriented programming. If you are not building a big hierarchically structured library of objects why should you care about inheritance and all of the wonderful principles of hierarchical type?

Put simply most programmers can just get on with using objects and leave the theory to others.


This book is about object-oriented Python and as such it has declared that it is going to do objects in a Pythonic way - but it doesn't. What it does is to present the standard object-oriented material with lots of Python examples. Its subtitle is "Master OOP by Building Games and GUIs and to be honest this is probably a better reason for reading it then learning about objects. Graphics is one area where objects are so obvious - shapes, sprites and so on - that you would invent the basics of objects if they werent' available. 

The first part of the book introduces objects and it does so via a card game and a bank simulation example. This is a reasonable way to start, but it then makes a big deal out of the idea of using a class to create instances and misses that fact that a class is an object too. In Python a class isn't an abstract entity that is used to create objects; it is an object in its own right. Understanding the relationship between the objects that a class creates and the class object itself is important, as it is the way functions, which are also objects, become bound methods. This is something a Python programmer needs to understand to avoid subtle errors. None of this is explained; instead we have a treatment of Python as if it was Java or any object-oriented language.  This isn't about Python object-oriented programming, but rather object-oriented programming that happens to use Python for its examples.

Part II of the book is about graphical user interfaces with Pygame. This is a set of examples that do illustrate object oriented-programming, but could just as well be said to illustrate event driven or asynchronous programming. It does make good sense to create graphics entities as objects - a ball for example as at the very basic level it allows you to create multiple instances complete with animation.

Part III is about object-orientation pure and simple. It covers the usual subject matter - encapsulation, polymorphism and inheritance. This is a very thin explanation from the point of view of theory and it uses the very familiar example of geometric objects -  square, rectangle, triangle, etc. This standard example contains one of the problems with the idea that program object hierarchies should mirror world object hierarchies, yet it goes uncommented. Is a square a subclass of a rectangle or vice versa. The problem is ignored because the proposed hierarchy isn't deep, so not really modelling anything much. There is no discussion of the meaning or role of type hierarchies and multiple inheritance is mentioned without any discussion of the diamond problem and how Python avoids it using the mro. The Liskov substitution principle is also noticeable by its absence. This is a very standard, very lightweight, and mostly non-Pythonic, examination of object-orientation.

The final part of the book is about OOP in game development and having covered the implementation of a card game, goes on to animation, state machine animation and MVC design. I can't say that I think that MVC fits in with game design, but I could be wrong.


This is a book more about graphics and game programming that about object-oriented ideas. If you are interested in this area then you might get something out of this book. If you want to really understand objects and the philosophies behind programming with them then you might not be so happy. You will learn the basics but you won't discover the unique and powerful approach to the problem that Python brings to the table. 

  •  Mike James is the author of  Programmer's Python: Something Completely Different series of books.Currently a three-volume set, the first title, Programmer's Python: Everything is an Object, looks at what makes Python's approach to objects different from that of Java and other OO languages, 

To keep up with our coverage of books for programmers, follow @bookwatchiprog on Twitter or subscribe to I Programmer's Books RSS feed for each day's new addition to Book Watch and for new reviews.


Classic Computer Science Problems in Python

Author: David Kopec
Publisher: Manning
Date: March 2019
Pages: 224
ISBN: 978-1617295980
Print: 1617295981
Kindle: ‎ ‎ B09782BT4Q
Level: Intermediate
Audience: Python developers
Category: Python
Rating: 4
Reviewer: Mike James
Classic algorithms in Python - the world's favourite language.

T-SQL Fundamentals (Microsoft Press)

Author: Itzik Ben-Gan
Publisher: Microsoft Press
Pages: 608
ISBN: 978-0138102104
Print: 0138102104
Kindle: B0BTLBXF8V
Audience: T-SQL developers
Rating: 5
Reviewer: Kay Ewbank

Itzik Ben-Gan is a highly respected Microsoft Data Platform MVP, and the earlier editions of this book were already ver [ ... ]

More Reviews





Last Updated ( Wednesday, 22 November 2023 )