500 Lines or Less
500 Lines or Less
by Michael DiBernardo (ed.)
Publisher: The Architecture of Open Source Applications 2016
Number of pages: 478
License(s): Creative Commons Attribution 3.0 Unported
This is the fourth volume in the Architecture of Open Source Applications series, and the first to not feature the words “open source applications” anywhere in the title.
The first three volumes in the series were about big problems that big programs have to solve. For an engineer who is early in their career, it may be a challenge to understand and build upon programs that are much bigger than a few thousand lines of code, so, while big problems can be interesting to read about, they can also be challenging to learn from.
500 Lines or Less focuses on the design decisions that programmers make in the small when they are building something new. The programs you will read about in this book were all written from scratch for this purpose (although several of them were inspired by larger projects that the authors had worked on previously).
Before reading each chapter, we encourage you to first think about how you might solve the problem. What design considerations or constraints do you think the author is going to consider important? What abstractions do you expect to see? How do you think the problem is going to be decomposed? Then, when reading the chapter, try to identify what surprised you. It is our hope that you will learn more by doing this than by simply reading through each chapter from beginning to end.
Writing a useful program in fewer than 500 lines of source code—without resorting to cheap tricks—is a challenging exercise in itself; writing one to be read for pedagogical purposes when neatly rendered in a printed book is even tougher. As such, the editors have occasionally taken liberties with some of the source formatting when porting it into the book. The original source for each chapter can be found in the
code subdirectory of its project folder.
We hope that the experiences of the authors in this book will help you grow out of your comfort zone in your own programming pract