500lines
500 Lines or Less
500 Lines or Less is a programming book where experienced developers walk through small complete programs, a crawler, a spreadsheet, a static analyzer, explaining the design decisions behind them to teach you to think like a software architect.
500 Lines or Less is the source repository for a programming book of the same name, the fourth volume in the Architecture of Open Source Applications series. The book takes a different approach from most programming tutorials: instead of teaching syntax or introducing frameworks, it explains how experienced programmers think about design decisions — why they split code into particular modules, when to use inheritance versus composition (two ways of organizing code), and how to anticipate future changes.
Each chapter is a walkthrough of a small, self-contained program — no more than 500 lines of code — that solves a classic software engineering problem. Examples include a web crawler, a spreadsheet, a static analysis tool, an object model, and a pedometer. Each program was written by a different experienced contributor who explains the thinking behind the design choices made along the way.
The book is part of a series aimed at helping programmers understand how well-known types of software are actually built. All written content is under a Creative Commons license (free to share with attribution for non-commercial use), and all code is under the MIT license. Someone would read this to develop better intuitions about software architecture and design at a scale they can fully grasp and study.
Where it fits
- Study how experienced programmers design a web crawler, spreadsheet, or static analysis tool by reading their annotated source code
- Read chapter walkthroughs to understand when to use inheritance versus composition and how to plan for future changes
- Use the example programs as teaching material for discussing software design trade-offs in a team or study group