ABSTRACT

The best way to learn design in any field is to study examples, and some of the best examples of software design come from the tools programmers use in their own work. Software Design by Example: A Tool-Based Introduction with JavaScript therefore builds small versions of the things programmers use in order to demystify them and give some insights into how experienced programmers think. From a file backup system and a testing framework to a regular expression matcher, a browser layout engine, and a very small compiler, we explore common design patterns, show how making code easier to test also makes it easier to reuse, and help readers understand how debuggers, profilers, package managers, and version control systems work so that they can use them more effectively.

This material can be used for self-paced study, in an undergraduate course on software design, or as the core of an intensive weeklong workshop for working programmers. Each chapter has a set of exercises ranging in size and difficulty from half a dozen lines to a full day’s work. Readers should be familiar with the basics of modern JavaScript, but the more advanced features of the language are explained and illustrated as they are introduced.

All the written material in this project can be freely reused under the terms of the Creative Commons - Attribution license, while all of the software is made available under the terms of the Hippocratic License. All proceeds from sale of this book will go to support the Red Door Family Shelter in Toronto.

Features

• Teaches software design by showing programmers how to build the tools they use every day

• Each chapter includes exercises to help readers check and deepen their understanding

• All the example code can be downloaded, re-used, and modified under an open license

chapter 1|6 pages

Introduction

chapter 2|16 pages

Systems Programming

chapter 3|18 pages

Asynchronous Programming

chapter 4|12 pages

Unit Testing

chapter 5|16 pages

File Backup

chapter 6|14 pages

Data Tables

chapter 7|16 pages

Pattern Matching

chapter 8|12 pages

Parsing Expressions

chapter 9|16 pages

Page Templates

chapter 10|18 pages

Build Manager

chapter 11|20 pages

Layout Engine

chapter 12|14 pages

File Interpolator

chapter 13|12 pages

Module Loader

chapter 14|16 pages

Style Checker

chapter 15|12 pages

Code Generator

chapter 16|14 pages

Documentation Generator

chapter 17|16 pages

Module Bundler

chapter 18|12 pages

Package Manager

chapter 19|14 pages

Virtual Machine

chapter 20|16 pages

Debugger

chapter 21|2 pages

Conclusion