Python 3 Object Oriented Programming
By Dusty Phillips
A few months ago, I wrote a preview of this book. A little over a week ago, I received my copy of the book. Before we get to the review though, I want to give full disclosure: Packt contacted me to be a "Reviewer" (read: technical editor) for this book last December. The payment? They gave me a copy of the book, one copy of any other book from their catalog that I wanted and my name appears in the book. If you think that remuneration will cause me to biased, so be it. Everyone is biased in some way or another. I tend to be harsher on things that I'm involved in though.
Well, enough of the baring of my soul. Let's take a look at the book. The author of this book really likes Unified Modeling Language (UML) class diagrams, so if you find those helpful in learning, then you'll like this book. The entire first chapter is made up of text and UML diagrams, after all and it gives a brief introduction to the Object Oriented philosophy. Chapter 2 jumps into Python Objects, modules and packages. Chapter 3 digs into inheritance (basic and multiple) and polymorphism. Chapter 4 is all about exceptions in Python. Chapter 5 attempts to explain when to use object oriented programming. I thought that was an interesting chapter because it seems to me that colleges browbeat their students into thinking they should use OOP for everything. Chapters 6 and 7 dig into the Python standard library by covering tuples, lists, dicts, sets, various comprehensions, generators and functions. I learned a lot about comprehensions from these chapters that made me wish I used Python 3 more. Chapters 8 and 9 cover Python Design Patterns. I found these chapters to be the highlight of the book and very interesting. He covers the following patterns: decorator, observer, strategy, state, singleton, template, adapter, facade, flyweight, command, abstract factory and composite.
Chapter 10 covers the basics of files and strings; chapter 11 goes overs testing with unit tests and py.test. Last, chapter 12 does a quick overview of common Python 3 libraries, like SqlAlchemy, Tkinter, PyQt, lxml and CherryPy.
When I was reviewing the book, Chapters 5 and 8 had some Python Imaging Library examples. The author had noted that PIL hadn't been ported to Python 3 at the time, but he thought it would be by publishing. Alas, the people behind PIL still do not have a Python 3 port. So I was curious how the author handled this conundrum. It turns out that he ended up replacing PIL with pygame. An interesting choice that appears to work all right for the examples. I didn't re-read the book (although I plan to at some point). Instead, I just did a spot check to see if the author followed any of my suggestions or fixed errors. It appears that he did.
This book was good before he fixed the problems with it. There's more theory here than you normally find in Python textbooks, but I found the examples intriguing and he has unusual exercises at the end of the chapters that should keep you thinking. I'm pretty sure I would have been quite happy if I had purchased this book. If you're new to Python 3 and specifically object oriented programming or you want to learn about programming patterns, I recommend this book. If you want a sneak peak, Packt has Chapter 7 available on their website here.
Copyright © 2022 Mouse Vs Python | Powered by Pythonlibrary