Book Image

Python 3 Object-Oriented Programming - Second Edition

By : Dusty Phillips
Book Image

Python 3 Object-Oriented Programming - Second Edition

By: Dusty Phillips

Overview of this book

Python 3 is more versatile and easier to use than ever. It runs on all major platforms in a huge array of use cases. Coding in Python minimizes development time and increases productivity in comparison to other languages. Clean, maintainable code is easy to both read and write using Python's clear, concise syntax. Object-oriented programming is a popular design paradigm in which data and behaviors are encapsulated in such a way that they can be manipulated together. Many modern programming languages utilize the powerful concepts behind object-oriented programming and Python is no exception. Starting with a detailed analysis of object-oriented analysis and design, you will use the Python programming language to clearly grasp key concepts from the object-oriented paradigm. This book fully explains classes, data encapsulation, inheritance, polymorphism, abstraction, and exceptions with an emphasis on when you can use each principle to develop well-designed software. You'll get an in-depth analysis of many common object-oriented design patterns that are more suitable to Python's unique style. This book will not just teach Python syntax, but will also build your confidence in how to program. You will also learn how to create maintainable applications by studying higher level design patterns. Following this, you'll learn the complexities of string and file manipulation, and how Python distinguishes between binary and textual data. Not one, but two very powerful automated testing systems will be introduced in the book. After you discover the joy of unit testing and just how easy it can be, you'll study higher level libraries such as database connectors and GUI toolkits and learn how they uniquely apply object-oriented principles. You'll learn how these principles will allow you to make greater use of key members of the Python eco-system such as Django and Kivy. This new edition includes all the topics that made Python 3 Object-oriented Programming an instant Packt classic. It's also packed with updated content to reflect recent changes in the core Python library and covers modern third-party packages that were not available on the Python 3 platform when the book was first published.  
Table of Contents (21 chapters)
Python 3 Object-oriented Programming Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Introduction to the second edition
Preface
Index

Introduction to the second edition

I have a confession to make. When I wrote the first edition of this book, I didn't have a clue what I was doing. I thought I knew Python and I thought I knew how to write. I quickly learned that this was false. Luckily, I became adept at both by finishing the book!

I was so afraid that people wouldn't like Python 3 Object Oriented Programming that I skipped Pycon for two years straight. After a couple dozen positive reviews, my confidence was boosted and I finally attended Pycon 2012 in Santa Clara. I soon discovered that nobody had ever heard of me or my book. So much for arrogance!

I was also afraid to reread the book after completing it. So while it has received many accolades, the copy on my shelf has remained firmly shut, save for when I open it for reference to answer a reader's query. In preparing this second edition, I was finally forced to face my demons. To my surprise and joy, I discovered that the book I wrote five years ago was both accurate and enjoyable, just as many reviewers had suggested.

Shortly after that initial rereading, I got my first ever negative review on Amazon. It would have been devastating had I read it directly after completing the project. Fortunately, four years of good reviews and my own confidence in the writing allowed me to ignore the vitriol and take the remainder as constructive feedback. The truth is many of the flaws the reviewer had pointed out were features at the time the book was originally published. Python 3 Object Oriented Programming was showing its age, and it was clearly time for an update. You're holding the result in your hands (or flipping through it on your e-reader).

I've often wondered why authors describe in detail what has changed between the editions of a technical book. I mean, seriously, how many people reading this second edition have read the first one? As with software versions, you safely assume the latest edition is the best, and you don't really care about the project's history. And yet, this project has consumed so much of my life over the past year that I can't leave without a few words about how much better the book has become.

The original book was a little disorganized. Many chapters flowed directly into the next one, but there were a few key places where the topic change was jarring, or worse, irrelevant. The two chapters preceding the discussions about design patterns have been reorganized, reversed, and split into three chapters that flow cleanly into the next topic.

I've also removed an entire chapter on third-party libraries for Python 3. This chapter made more sense when both the book and Python 3 were new. There were only a few libraries that had been ported to Python 3 and it was reasonable to have a best of breed discussion about each of them. However, I was unable to cover any of those topics in detail, and frankly, I could write an entire book on any one of them.

Finally, I've added an entire new chapter on concurrency. I struggled with this chapter and I can freely admit that it's not directly related to object-oriented programming. However, much like the chapter on unit testing, I think that understanding concurrency is an integral part of all programming and especially of object-oriented programming in the Python ecosystem. You are, of course, free to skip those chapters if you disagree (or until you discover a reason to change your mind).

Enjoy the book and your journey into the world of object-oriented programming.

Dusty Phillips