Book Review: “A Mind at Play”

A Mind At Play by Jimmy Soni and Rob Goodman should be on every techie’s gift list this year because it is superb and because everyone in a technology or information field should know who Claude Shannon is.

When Jimmy Soni offered me a review copy of this new biography of Claude Shannon, I immediately said yes. I knew a little about Shannon from reading The Idea Factory and The Information, and I was looking forward to learning more. The results in A Mind At Play are just what I hoped for.

Soni and Goodman do an excellent job of presenting Shannon’s technical work  to a mostly lay audience, although there is enough depth (and footnotes) to allow you to dig deeper if you are interested. The explanation of his information theory work is clearly laid out and builds from the simplifying model of how communication works to the stochastic analysis of letter frequency and redundancy to finally reach the description of the Shannon limit on the communication speed over any medium. They also cover his contributions in other fields like genetics and mathematics.

The technical sections are interspersed with anecdotes from his life, from his education through his career at Bell Labs and MIT, showing how his continual “constructive dissatisfaction” with the state of the world served as a motivating force in his exploration of a wide range of topics. He set his own course and focused on the things he wanted to, and was privileged to have the freedom to do so. While some of the topics seemed like play, his work always exposed something new; at least to him.

For more details, download this interview with the authors on the Software Engineering Daily podcast.

The Idea Factory

I just finished reading The Idea Factory by Jon Gertner. It’s a
history of Bell Labs and its impact on modern technology. I love these
sorts of books, that talk about engineers and scientists solving
problems and discovering how the world works. Gertner’s writing moves
along at a nice steady pace, and he tells the stories with a good
balance of scientific detail – not so much that you need a physics
degree, but enough that you understand the difficulty and significance
of the work.

Most of the book talks about a different era, when attitudes about
monopolies were different and pure research was funded with fewer
expectations of immediate profit. That model no longer works in our
modern competitive environment, and I am left wondering how we will
manage to make the next fundamental leap forward (and what that leap
will be) when most businesses can’t afford to take such a long view,
and most research universities struggle for funding.

I also want to know who the Jon Gertner, Tracy Kidder, or Scott
Rosenberg
of OpenStack will be.

Foreword for “Python in Practice”

This is the foreword I wrote for Python in Practice, by Mark
Summerfield, available now in print and ebook formats from Amazon
and directly via the publisher.


I have been building software with Python for 15 years in various
application areas. Over that time I have seen our community mature and
grow considerably. We are long past the days of having to “sell”
Python to our managers in order to be able to use it in work-related
projects. Today’s job market for Python programmers is
strong. Attendance at Python-related conferences is at an all time
high, for regional conferences as well as the big national and
international events. Projects like OpenStack are pushing the language
into new arenas and attracting new talent to the community at the same
time. As a result of the robust and expanding community, we have more
and better options for books about Python than ever before.

Mark Summerfield is well known in the Python community for his
technical writing about Qt and Python. Another of Mark’s books,
Programming in Python 3, is at the top of my short list of
recommendations for learning Python, a question I am asked frequently
as the organizer of the user group in Atlanta, Georgia. This new book
will also go on my list, but for a somewhat different audience.

Most programming books fall at either end of a spectrum that ranges
from basic introductions to a language (or programming in general) to
more advanced books on very focused topics like web development, GUI
applications, or bioinformatics. As I was writing The Python Standard
Library by Example
, I wanted to appeal to readers who fall into the
gap between those extremes – established programmers and generalists,
both familiar with the language but who want to enhance their skills
by going beyond the basics without being restricted to a specific
application area. When my editor asked me to review the proposal for
Mark’s book, I was pleased to see that Python in Practice is designed
for the same types of readers.

It has been a long time since I have encountered an idea in a book
that was immediately applicable to one of my own projects, without it
being tied to a specific framework or library. For the past year I
have been working on a system for metering OpenStack cloud
services. Along the way, the team realized that the data we are
collecting for billing could be useful for other purposes, like
reporting and monitoring, so we designed the system to send it to
multiple consumers by passing the samples through a pipeline of
reusable transformations and publishers. At about the same time that
the code for the pipeline was being finalized, I was also involved in
the technical review for this book. After reading the first few
sections of the draft for chapter 3, it became clear that our pipeline
implementation was much more complicated than necessary. The coroutine
chaining technique Mark demonstrates is so much more elegant and easy
to understand that I immediately added a task to our roadmap to change
the design during the next release cycle.

Python in Practice is full of similarly useful advice and examples
to help you improve your craft. Generalists like me will find
introductions to several interesting tools that you may not have
encountered before. And whether you are already an experienced
programmer or are making the transition out of the beginner phase of
your career, this book will help you think about problems from
different perspectives and give you techniques to create more
effective solutions.

Doug Hellmann
Senior Developer, DreamHost

Book Review: Pro Git

We are considering moving off of Subversion for version control and
so I have been investigating more modern DVCS tools such as
Mercurial and git. I use Mercurial for all of my personal
projects, and feel fairly comfortable with its basic work-flow. I
wanted to pick up a book on git, and the number one recommendation
when I asked on Twitter was Pro Git by Scott Chacon.

Quick Review

Inspired by Gene Ambaum and Bill Barnes’ review short-cuts, here’s my
review for the impatient reader:

Why I picked it up: I needed to learn more about git to decide if
it was the right tool for us and how it would fit into our work-flow.

Why I finished it: Chacon’s writing is clear and engaging. He
covered all of the tips for using git that I wanted and then included
some implementation details that are useful for understanding DVCS
theory, but not absolutely necessary for using git.

I’d give it to: A developer learning or evaluating git, or
researching DVCS tools in general.

Available Formats

The content of Pro Git is available for free from progit.org.
There are download links for the PDF, Mobi, and epub editions, or you
can browse the HTML version on-line. I purchased the paper edition,
published by Apress. It isn’t entirely clear which version is more
up to date, though, since the PDF I downloaded only contained a
placeholder for chapter 1 (“Introduction”).

Contents of the Book

Chapter 2 gives an overview of version control system types to explain
where git fits in. It also covers the features of git that make it
different from centralized tools, and explains why the data model used
by git ensures the authenticity of a repository’s contents. It
concludes with instructions for installing git and setting up your
first repository.

Chapter 3 explains how to use the basic features of git for adding
files to a repository, modifying them, tracking those changes, and
distributing the changes to other repositories. Branching, a
fundamental concept in git, is covered in chapter 4. The book covers
the basic mechanics of creating and working with branches, as well as
suggested work-flows for using them effectively.

Chapters 5 and 6 talk about collaborating with git. Chapter 5 shows
how to set up a central git server. Three options are discussed, ssh,
HTTP, and git’s own protocol. I only skimmed this material because it
was not relevant for my evaluation. Many other readers working on open
source projects will probably be able to skip it, too, since it is
easy to set up public repositories on hosting sites such as Github.
Chapter 6 covers distributed work-flows for sharing code with other
developers. It includes several common scenarios such as maintaining a
central source, using lieutenants to screen changes before they go
into trunk, etc. This information was very useful for my evaluation
because I was able to see immediately how my company’s work-flow would
map to git’s feature set.

Chapter 7 goes into detail about some advanced usage features. I
expect this information to be more useful after we have been using git
for a little while. Chapter 8 is about options for customizing git,
from basic settings like your identity, to server-side hooks for
automating changes on deploy. Chapter 9 talks about how to use git
with other version control tools, either as a way to import data into
git or by using git as a front end for systems such as subversion.

Chapter 10 covers internal implementation details of git. I found this
information interesting, but it probably isn’t that relevant for
someone who just wants to use the tool.

Review

Pro Git is an excellent book. It is clearly written, covers all of
the information you need without introducing any unnecessary
complications. When I looked at git several years ago the information
I found on-line was confusing and turned me off. After reading through
Pro Git and experimenting with some of the examples I felt ready to
move all of my source code into git for safe-keeping. I don’t
anticipate needing another book to explain any more details about
using git as a version control system.

I expect to keep Pro Git handy as a reference as we plan the
migration of our source code repository from subversion to git, and
for a while afterward, until the commands I need to use become
ingrained.

Book Review: Python Testing Cookbook

I received a review copy of Python Testing Cookbook by Greg
Turnquist
late last week. The timing was perfect, since we have been
talking a lot about increasing the amount of automation we use in our
testing at work. I scanned through the book quickly to get a sense for
whether I should give it to our QA team, and I liked what I found.

Quick Review

My review for the impatient reader:

Why I picked it up: The timing was perfect. We are applying more
test automation techniques as part of improving our QA process at
work, and I hoped to find some useful tools.

Why I finished it: It’s a fast read, especially when you skim over
the code. There are a lot of good tips, and it introduces a range of
tools, which is just what I needed.

I’d give it to: Our QA team. It will explain some of the tools the
development team is already using and introduce others that are well
suited for the needs of the QA team.

Review

I’m not normally a fan of “cookbook” style technology books. The ones
I have read were disorganized grab-bags of random suggestions only
useful to someone with a background in the topic they covered. This
book is an exception. The author did a good job of organizing Python
Testing Cookbook
to avoid the grab-bag feeling. Each chapter
introduces a new concept, and the sections and recipes build on each
other in a steady progression. Because it introduces basic concepts
such as the unittest and doctest frameworks before moving to
test runners like nose and advanced tools such as mock,
Pycurracy, robotframework, lettuce, and Jenkins, the book
is useful for someone approaching test automation for the first time
who wants to read straight through, without sacrificing the
quick-reference goal of the cookbook format.

I’m not normally a fan of “cookbook” style technology books. This
book is an exception.

The book stands up well as a beginner- or intermediate-level text
because it takes the reader beyond a strict “how to” structure. In
addition to the step-by-step instructions you expect, each recipe
explains how the techniques employed work and gives advice about when
and why to use them. Some of the best tips in the book are included
in those sections.

I think our QA team will find the book especially helpful because it
covers more than green field development work. Chapter 9 in particular
talks about how to apply the techniques covered earlier with legacy
systems. Those tips encourage you to start testing, even if it is a
big project and you’re unlikely to reach 100% coverage in the
short-term.

“Don’t get caught up in the purity of total isolation or worry about
obscure test methods. First thing, start testing.”

Chapter 4 covers a few interesting techniques and tools for “Behavior
Driven Development”. Lettuce piques my interest, as I hadn’t heard
of it before. The ability to describe tests independently of the code
that performs them will be useful for non-programmers (as long as they
have some help to bind the test descriptions to those checks, of
course).

I only have two negative comments to make. Most or all of the program
output is presented as screen shots. While I’m sure that made their
editing process easier (there’s no need to worry about whether a copy
editor broke the output formatting or “corrected” the language in an
error message), the white-on-black images don’t come out well in the
printing. In a few cases is looks like the opacity for the terminal
window was not set high enough to mask the text from other
windows. It’s distracting, but the important text is clearly legible,
so in the end it isn’t a big problem.

The other point is related to scope. A few of the more advanced tools
(Jenkins and TeamCity), are introduced without a lot of depth. Basic
use patterns are presented to get you started, and reference links are
included for readers who want to find out more about the tools. I
think this is a limitation of the size and format of the book, rather
than an oversight, and so I can’t complain too much, but those
sections do stand out as thinner than the others.

Recommendation

I recommend this book. It exceeded my expectations (both of the
format, and of Packt’s reputation), and provides a clear introduction
to tools and techniques for testing your application from a variety of
perspectives.

Disclaimer: I received a free review copy of this book from the
publisher.

Book Review: Masterminds of Programming

Quick Review

My review for the impatient reader:

Why I picked it up: It promised insight from a collection of
programming language inventors.

Why I finished it: Although there was less depth than I expected,
it was interesting to see how divergent the interviewees’ opinions are
on some topics.

I’d give it to: A serious programmer who has been working for a
few years and is ready to grow beyond the usual “how to” books and is
looking for a more contemplative book.

Review

Masterminds of Programming is a collection of interviews with
“Creators of Major Programming Languages.” It is edited by Federico
Biancuzzi and Shane Warden, and was published by O’Reilly and
Associates in 2009. It is organized based on the language, with each
of the 17 chapters containing an interview with the creator, or
creators in some cases. It covers a wide variety of languages,
including compiled languages like C++ and Objective C, interpreted
languages like Python and Perl, and even UML.

Although it was interesting to learn a little about the backgrounds of
languages I had heard of but never used, it was more enlightening to
read about the broader topics the interviewees discussed. I found it
especially fascinating to see the conflicting opinions many of them
hold on some topics.

“Whenever I hear people boasting of millions of lines of code, I
know they have grievously misunderstood their problem. There are no
contemporary problems requiring millions of lines of code.” –
Chuck Moore, Forth

Although the questions are not the same in each interview, a few
common themes stand out. For example, opinions vary on the importance
of working on a team vs. individually. It is not entirely surprising
that the academics tended to favor individual work, or at least not
have extensive experience working on teams.

“The whole business of optimizing and coding is absolutely
wrong. You don’t do that. You optimize only if you have to and you
do it later. Higher level languages optimize computer time
automatically because you make fewer errors.” – Tom Kurtz, BASIC

The misguided use of object orientation is brought up several times,
and not just by designers of functional languages. Concurrency and
its
relationship with OOP and functional programming is also discussed in
a few places. There is a general consensus in the interviews that
concurrency is one of the important issues yet to be resolved in
computing, but there is little agreement about the solution.

There is more agreement on the need to keep languages, and programs,
simple. Several interviews include or refer to the quote from
Einstein, “Everything should be made as simple as possible, but no
simpler.” I also was surprised to see how many times older languages
such as Algol-60 and Simula were brought up as influences on more
“modern” languages, although perhaps I should not have been.

Conclusions

I recommend this book for serious programmers looking to move beyond
the usual “how to” books to find a more contemplative book. The
interviews have been put together with obvious care. They cover
similar topics without simply repeating the same question to each
participant. The result is easy to read, while still encouraging the
reader to go slowly and consider what is being said.

Book Review: Porting to Python 3

Lennart Regebro sent me a copy of his Porting to Python 3 following
PyCon 2011, and now that work on my own book is nearly complete I was
finally able to sit down and study it. I have two major Python 3
porting projects ahead of me soon, and I hoped that Lennart’s book
would guide those projects. I was not disappointed.

Quick Review

Inspired by Gene Ambaum and Bill Barnes’ review short-cuts, here’s my
review for the impatient reader:

Why I picked it up: I am preparing to port PyMOTW to Python 3
and
we are starting to study what it would take to make the switch at
work, too.

Why I finished it: At a computationally pleasing 128 pages, the
book gets right to the point, without a lot of fluff and filler.

I’d give it to: Developers with enough Python 2 code that porting
to version 3 is going to be a major project. Programmers who want to
support both 2 and 3 at the same time will also find helpful
information.

Python 2 vs. 3

The Python community is in an interesting period of change. Major
development of Python 2 has stopped with release 2.7, but there are
still a lot of developers out in the world using it as their primary
tool. The number of packages available under Python 3 continues to
grow steadily, but there is still a lot of legacy code to be ported,
supported, or simply cut off. Lennart Regebro’s new book, Porting to
Python 3
, is a guide for those of us who have not yet completed our
transition. It covers the options for supporting Python 3, either
concurrently or exclusively, and includes guidance about choosing the
best approach for your project.

Just the Facts

While there is a lot to like about Porting to Python 3, the two
aspects that stand out are the size and the organization of the
content. The author does not beat around the bush or belabor his
point. His writing is clear and concise, resulting in a slim handbook
that can be given to a manager who needs to understand the
ramifications of moving from Python 2 to Python 3, while still
containing enough detail to be used by a developer for reference
during the porting process.

The author does not beat around the bush or belabor his point.

Strategies for Successful Migration

The material in the book is organized in exactly the way you need to
digest it. The first chapter is a quick explanation of what Python 3
is, with guidance for deciding when, and whether, to make the
switch. Chapter two covers strategies for migrating, either all at
once or during installation so that both Python 2 and 3 can be
supported with the same code base.

Next, the author helps you prepare for the porting effort by providing
tips for bringing your code into the best beginning state. He covers
the process for staging the migration by getting the code to run
correctly under Python 2.7, possibly with a compatibility layer so
that the same source can run under Python 3 as well.

The author helps you prepare by providing tips for bringing your
code into the best beginning state.

Chapter 4 introduces 2to3, the primary tool for automatically
porting Python 2 code to run under Python 3. 2to3 supports a large
number of conversions, but no automatic solution is going to be
perfect, so chapter 5 explains how to address the most commonly found
cases where the tool may have made the wrong decision or where it
could not translate the code at all.

Chapter 6 lists the cases where using more “modern idioms” will either
make the code easier to maintain for both Python 2 and 3, or make it
run more cleanly under Python 3.

Advanced Topics

The rest of the chapters are about more advanced topics, including
techniques for supporting Python 2 and 3 without using 2to3; changes
in the C API that affect extension modules; and customizing 2to3 to
handle cases that appear in your code, but are not common enough to
already be addressed by the core library.

Handy Reference

The appendices provide concise reference list of common porting issues
and their solutions, so it is not necessary to search the entire book
for a fix when you encounter a problem. There is also a list of the
standard library modules that have been renamed or otherwise
reorganized, something I will find especially useful while working on
PyMOTW.

Conclusions

Porting to Python 3 is self-published, and that shows in some of the
rough edges. But those do not detract from the value of the
information and advice that it contains. I recommend it for developers
preparing to migrate their code base, especially if there is enough
code to make it a major project. Programmers who want to support both
2 and 3 at the same time will also find helpful information.

Sample Chapter

The website for the book has chapter two, Migration
Strategies
, available for free.

Disclaimer: I received a free review copy of this book from the
author.

Book Galleys

My publisher arranged to send physical copies of *The Python Standard
Library By Example*
so I could bring them to PyCon. Some of them are
going into the door prize pool, and there will be at least one copy in
the bookstore for anyone who wants to look it over before committing to
buying. Although, the Safari edition is probably more convenient for
perusing. This book isn’t going to be exactly light reading:

http://doughellmann.com/blog/wp-content/uploads/2011/03/DSC00549.jpghttp://doughellmann.com/blog/wp-content/uploads/2011/03/DSC00550.jpg