Exercises in Programming Style  book cover
1st Edition

Exercises in Programming Style

ISBN 9781482227376
Published June 2, 2014 by Chapman and Hall/CRC
304 Pages 27 B/W Illustrations

FREE Standard Shipping
USD $49.95

Prices & shipping based on shipping country


Book Description

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 33 different styles for writing the term frequency task. The styles are grouped into nine categories: historical, basic, function composition, objects and object interactions, reflection and metaprogramming, adversity, data-centric, concurrency, and interactivity. The author verbalizes 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.

Table of Contents

Good Old Times
Go Forth

Basic Styles
Code Golf

Function Composition
Infinite Mirror
Kick Forward
The One

Objects and Object Interaction
Closed Maps
Abstract Things
Bulletin Board

Reflection and Metaprogramming

Passive Aggressive
Declared Intentions

Persistent Tables
Lazy Rivers

Map Reduce
Double Map Reduce


View More


"… the best programming book to come along in many years. … Every chapter is a delight. … Exercises in Programming Style is an instant classic. I honestly cannot think of a more enlightening and more valuable text that’s been published since the turn of the century. The hardest part about reviewing it is coming up with a way to say ‘Every developer should read this book’ in a way that doesn’t come across as clichéd and rote. Seriously. Every developer should read this book."
—Larry O’Brien, "Code Watch: The best programming book of the decade," Software Development Times, July 29, 2015

A 2014 Best of Computing Notable Book
"Lopes presents a simple problem (determining word frequency in a text) and then generates 33 solutions (all in the Python language) that are markedly different. The commentary for each concisely and clearly states the reasons why the approach under consideration might be a good one, or at least why it is of interest historically. She states that the code 'is for everyone who enjoys the art of programming,' and as one of those people I thank her for this book. ... The book can also serve as a primer or a refresher for those who are not taking a course, but who are interested in either the history of languages or the wealth of ideas that are embedded in languages. It is easy to read, and the reader can easily understand from the examples and descriptions why the various ideas embedded in the examples are (or in some cases were) important."
—David Barnard, ACM Computing Reviews, February 2015

"This is the most important book on programming in the last 20 years."
—James Noble, Victoria University of Wellington, New Zealand

"Exercises in Programming Style is an instant classic. In the spirit of Queneau’s Exercises in Style, Cristina examines a common programming problem though the lens of different programming styles, each shaped by different constraints. It is often said that great writers read, and so it may be said of great programmers: they read and learn from the style of others. Cristina’s book offers a most rewarding journey through the landscape of languages and idioms and will help professional programmers advance their craft."
—Grady Booch, IBM Fellow, Chief Scientist for Software Engineering, IBM Research

"It is difficult to appreciate a programming style until you see it in action. Cristina's book does something amazing: it shows us dozens of styles in action on the same program. The program itself is simple. The result, though, is a deeper understanding of how thinking differently about a problem gives rise to very different programs. This book not only introduced me to several new styles of thinking. It also taught me something about the styles I already knew well and use everyday. Raymond Queneau would be proud."
—Eugene Wallingford, Associate Professor, Department of Computer Science, University of Northern Iowa