Software Design by Example in Python 1: Introduction
In the early 2000s, the University of Toronto asked me to teach an undergraduate course on software architecture. After three runs I told the university to cancel it because of a lack of material: I’d bought a dozen textbooks on the subject, but between them, they devoted a total of less than 30 pages to describing the designs of actual systems.
Frustrated by that, Andy Oram and I persuaded some well-known programmers to contribute chapters to a book called Beautiful Code. Entries described everything from figuring out whether three points are on a line to the ground station software for the Mars Rover, but the breadth that made them fun to read also meant they weren’t particularly useful for teaching.
Amy Brown, Tavish Armstrong, Mike Dibernardo, and I then edited a four-book series called The Architecture of Open Source Applications in which the creators of various open source projects described their systems’ designs. These books were closer to what a junior programmer would need, but each author used the programming language of their choice and most people still wouldn’t be familiar with most of the problem domains.
So last year I published Software Design by Example: A Tool-Based Introduction with JavaScript, which I think is finally the book I needed twenty years ago. This year I’m proud to announce the sequel: Software Design by Example: A Tool-Based Introduction with Python. In it, I build tiny versions of Git, pytest, the Python VM, and other tools to show how they work and how experienced programmers think about software design.
I had two learner personas in mind as I wrote this book. The first is a student:
Maya has a master’s degree in genomics. She knows enough Python to analyze data from her experiments, but struggles to write code other people can use. These lessons will show her how to design, build, and test large programs in less time and with less pain.
The other is the instructor I was twenty years ago:
Yim teaches two college courses on software development. They are frustrated that so many books talk about details but not about design and use examples that their students can’t relate to. This book will give them material they can use in class and starting points for course projects.
As with its predecessor, all the material from SDXPY is available under open licenses, and all royalties from book sales go to support the Red Door Family Shelter in Toronto.
I hope to blog about one chapter each day for the next few weeks. Feedback is always welcome; while I’ve had to disable comments on this blog because of trolls, you can file issues in in the book’s GitHub repository. I hope you find the material useful, and I’m happy to answer questions by email.
I am grateful to the creators of diagrams.net, Black, Emacs, flake8, Glosario, GNU Make, isort, LaTeX, pip, Python, Remark, WAVE, and all the other open source tools used in creating these lessons: if we all give a little, we all get a lot. I would also like to thank everyone who took part in last year’s beta testing for early and ongoing feedback, especially Alberto Bacchelli and his students. Any errors, omissions, or misunderstandings that remain are entirely my fault.