This book is an enhanced version of the series Discover Python and Patterns.
It's free, you can download it there: DiscoverPythonAndPatternsWithGameProgramming.pdf.
The code and issue tracker are on github: github.com/philippehenri-gosselin/discoverpythonpatterns.
Python is not only an incredible programming language for learning but also an efficient solution for real applications. Thanks to all the improvements made in the past thirty years, Python has a unique programming style that leads to compelling and readable code.
Software design is also an excellent tool for development; unfortunately, it is less popular, perhaps because people often introduce it theoretically. Nevertheless, software design is a pragmatic solution to real problems. One can compare it to the organization of a restaurant, for which no one would think of obscure abstract concepts!
This book proposes to discover these programming tools through the creation of video games. Therefore, we don't list the many programming features with minimal examples as many pages do on the Internet. Instead, we run into some common issues during game development and see what Python or software design features we can use. This approach dramatically changes what the reader can learn. Most of the time, people present features but don't tell where we need them. Instead, we learn to identify the common problems in application development and what to do in each case.
We create a minimal text-based game and a small tank game with 2D graphics. The first game introduces the basics of functional programming and can be read by new programmers. The second game presents containers, object-oriented programming, and simple design issues and solutions.
This book targets different levels of knowledge in Python and software design, from people new to programming to developers with some basics. Consequently, more experimented programmers can skip the first chapters, while the new ones should read them carefully.
We dedicate the first chapter to new programmers: they don't need to know another programming language. Only the very first concepts are required, like understanding what a variable and addition are.
The following chapters require the skills presented in the first one: loops, branching, and functional programming. For these chapters, the readers don't need any knowledge in software design. Unfortunately, most courses poorly teach these topics, and in many cases, they wholly ignore them. As a result, we don't expect any basis and spend as much time as possible to present the first concepts.
The last chapters also assume that the tools presented in the previous ones are understood. It includes features of most programming languages, like lists, dictionaries, classes, inheritance, etc. Furthermore, Python programming style is not required. Concerning algorithms, the reader should know the basic ones, like iterating through a container. Finally, these chapters assume that the reader already saw the Game Loop and Observer patterns and can identify dependencies issues.
As the title suggests, this book is a discovery. It is intended to be read from the beginning to the end. Throughout the chapters, we follow the development of games and discover what can happen and what we can do.
This book is not a collection of concepts one can pick in random order. If one needs to get details about programming features, web search engines do the job. Instead, the purpose of the book is to connect neurons in the brain and get skills like Python style and the mind of a software architect. Seeing concrete examples, again and again, is the only solution to achieve this goal.
Philippe-Henri Gosselin, Ph. D., is a Software Architect and a Data Scientist at Interdigital R&D.
Before this position, he was a full professor at ENSEA, an engineering school on informatics and electronics.
He was the head of the last-year "Informatics and Systems" specialty and designed all the courses and related content to learn advanced software engineering.