Laura Wingerd and Christopher Seiwald
The main point is that every successful piece of software has an extended life in which it is worked on by a succession of programmers and designers….
Early in the planning of this book, greg wilson asked contributors whether Beautiful Code was an apt title. “Much of what you’re going to discuss is software design and architecture, rather than code per se,” he wrote us.
But this chapter is about the code. It’s not about what the code does, nor is it about how beautifully it does it. Instead, this chapter is about how the code looks: specifically, how certain human-visible traits of coding make serial collaboration possible. It’s about the beauty of “code in motion.”
What you’re about to read is borrowed largely from Christopher Seiwald’s article, “The Seven Pillars of Pretty Code.” In a nutshell, the Seven Pillars are:
Making alike look alike
Disentangling code blocks
Commenting code blocks
Blending in with existing style
While these may sound like mere coding conventions, they’re more than that. They’re the outward manifestations of a coding practice that keeps product evolution in mind.
In this chapter, we’ll see how the Seven Pillars have supported a piece of code that has been part of a commercial software system for over 10 years. That piece of code is DiffMerge, a component of the Perforce software configuration management system. DiffMerge’s job ...