ABSTRACT

The first edition of Exercises in Programming Style was honored as an ACM Notable Book and praised as "The best programming book of the decade." This new edition retains the same presentation but has been upgraded to Python 3, and there is a new section on neural network styles.

Using a simple computational task (term frequency) to illustrate different programming styles, Exercises in Programming Style helps readers understand the various ways of writing programs and designing systems. It is designed to be used in conjunction with code provided on an online repository. The book complements and explains the raw code in a way that is accessible to anyone who regularly practices the art of programming. The book can also be used in advanced programming courses in computer science and software engineering programs.

The book contains 40 different styles for writing the term frequency task. The styles are grouped into ten categories: historical, basic, function composition, objects and object interactions, reflection and metaprogramming, adversity, data-centric, concurrency, interactivity, and neural networks. The author states the constraints in each style and explains the example programs. Each chapter first presents the constraints of the style, next shows an example program, and then gives a detailed explanation of the code. Most chapters also have sections focusing on the use of the style in systems design as well as sections describing the historical context in which the programming style emerged.

part I|29 pages

Historical

chapter Chapter 1|9 pages

Good Old Times

chapter Chapter 2|8 pages

Go Forth

chapter Chapter 3|7 pages

Arrays

part II|34 pages

Basic Styles

chapter Chapter 4|6 pages

Monolithic

chapter Chapter 5|7 pages

Cookbook

chapter Chapter 6|9 pages

Pipeline

chapter Chapter 7|6 pages

Code Golf

part III|20 pages

Function Composition

chapter Chapter 8|4 pages

Infinite Mirror

chapter Chapter 9|5 pages

Kick Forward

chapter Chapter 10|6 pages

The One

part IV|44 pages

Objects and Object Interaction

chapter Chapter 11|8 pages

Things

chapter Chapter 12|5 pages

Letterbox

chapter Chapter 13|5 pages

Closed Maps

chapter Chapter 14|8 pages

Abstract Things

chapter Chapter 15|6 pages

Hollywood

chapter Chapter 16|6 pages

Bulletin Board

part V|28 pages

Reflection and Metaprogramming

chapter Chapter 17|4 pages

Introspective

chapter Chapter 18|6 pages

Reflective

chapter Chapter 19|5 pages

Aspects

chapter Chapter 20|8 pages

Plugins

part VI|39 pages

Adversity

chapter Chapter 21|5 pages

Constructivist

chapter Chapter 22|5 pages

Tantrum

chapter Chapter 23|6 pages

Passive Aggressive

chapter Chapter 24|7 pages

Declared Intentions

chapter Chapter 25|9 pages

Quarantine

part VII|24 pages

Data-Centric

chapter Chapter 26|7 pages

Persistent Tables

chapter Chapter 27|5 pages

Spreadsheet

chapter Chapter 28|6 pages

Lazy Rivers

part VIII|29 pages

Concurrency

chapter Chapter 29|8 pages

Actors

chapter Chapter 30|4 pages

Dataspaces

chapter Chapter 31|7 pages

Map Reduce

chapter Chapter 32|5 pages

Double Map Reduce

part IX|21 pages

Interactivity

chapter Chapter 33|7 pages

Trinity

chapter Chapter 34|9 pages

Restful

part X|56 pages

Neural Networks

chapter Chapter 35|9 pages

Dense, Shallow, under Control

chapter Chapter 36|9 pages

Dense, Shallow, out of Control

chapter Chapter 37|10 pages

Bow Tie

chapter Chapter 38|7 pages

Neuro-Monolithic

chapter Chapter 39|5 pages

Sliding Window

chapter Chapter 40|8 pages

Recurrent