#Review – The Practice of Programming

In a world of enormous and intricate interfaces, constantly changing tools and languages and systems, and relentless pressure for more of everything, one can lose sight of the basic principles— simplicity, clarity, generality— that form the bedrock of good software.

Kernighan, Brian W.; Pike, Rob (1999-02-09). The Practice of Programming (Addison-Wesley Professional Computing Series) (p. ix). Pearson Education. Kindle Edition.


Programming is a craft. Some programmers refuse to acknowledge this, insisting instead that it’s a scientific or engineering discipline. There are certainly elements of that but anything that allows a human to place their own distinctive style on a made thing is a craft.

Bridges look a certain way because that’s how the physics make them look, not because the engineer was feeling whimsical that day. That’s why one bridge looks a lot like another. When a carpenter makes a bookshelf, it shares the same functionality with other bookshelves. However, there are a hundred individual decisions made by the carpenter during the design and creation process. A bookshelf is physics seasoned by art.

Two software applications may have similar functions but the underlying source code tells a different story. Anyone who reads or writes code knows that the programmer imposes their own personal style on the code in hundreds of different ways. From the use of a favorite decision loop to the design and implementation of a particular data structure, programmers have always found a way to express themselves in their work.

The Practice of Programming was written to bring programmers who are swimming in complexity back to their roots and help them regain perspective. Just to be clear, this is not a book that will teach you how to program. However, if you are learning to program or even if you’re a veteran coder, you’ll get something useful out of this text.

Despite this, Kernighan and Pike don’t romanticize the work of programming. Instead they show that by embracing (or re-embracing) the fundamental principles of coding, you can become a better, more productive programmer.

They start with a style guide, because clean, consistent code is easier to read, debug and maintain. Establishing and maintaining a consistent coding style frees up your higher brain functions for more complex decisions and problem solving.

Next we move on to algorithms and data structures. These building blocks of software should be familiar to all coders but the right algorithm choice can make the difference between a program that takes an hour versus one that takes seconds to produce the desired result.

The authors build on this foundational knowledge with discussions on design, interfaces (how to efficiently pass data), debugging, testing (which reduces debugging), performance, portability and end with a chapter on notation which includes a discussion of tools that will help you generate code automatically.

The writing is crisp and direct. Kernighan and Pike speak to you, programmer to programmer. They have decades of combined experience in the coding trenches and understand the problems you face every day, whether you’re doing an assignment for school or creating a business analytics solution for your business.


#52WeeksOfCode Week 28 – Vala

Week: 28

Language: Vala

IDE(s): TextWrangler

History (official):

(From the Vala project home page)

“Vala is a new programming language that aims to bring modern programming language features to GNOME developers without imposing any additional runtime requirements and without using a different ABI compared to applications and libraries written in C..”

History (real):

Oh, there’s so much to unpack here.

new programming language” – okay, I’m with you so far.

modern programming language features” – I think I need some details on this one, bub.

GNOME developers” – Wait, I know this one! GNOME is a free, open source, cross-platform desktop environment. It’s mainly found on Linux systems, but you can also install it on Windows, Mac OS X and other UNIX variants.

The GNOME Project was started because the major desktop at the time, KDE (K Desktop Environment) used some proprietary code which made it problematic for certain open source projects. GNOME, on the other hand, is built on completely free code and all of the source code is readily available for download and hacking.

without imposing any additional runtime requirements”- A runtime system consists of any additional files required to run a program. Every piece of software has some kind of runtime requirements. In the case of Vala, this statement simply means that you don’t need to install anything extra to run applications written in Vala. (We’ll get to the reason why in a bit.)

without using a different ABI” – ABI is short for Application Binary Interface. An ABI, on a high level, is a set of rules for communication between different software modules. One use of an ABI is to allow programs to talk to the host operating system. The ABI specifies things like how to pass information from one program segment to another. Normally, a developer doesn’t have to worry about the ABI (it’s taken care of by his development system) except in certain cases when he’s writing code in different programming languages and he needs all of his programs to talk to each other. The ABI referred to in the official statement above is the GNOME ABI. (Like the runtime thing above, we’ll get to the why in a bit. Spoiler alert: it’s the same reason for both.)

To sum up, Vala is a good language for writing GNOME applications because you don’t need to install anything extra except a Vala compiler. Sounds good!

Just a minute. GNOME developers were writing software before Vala came along. Why do we need another programming language?

For the answer, we’ll have to send our imaginations back to the early ‘70s. The Summer of Love was still in recent memory, the conflict in Vietnam was winding down and the voting age was lowered from twenty-one to eighteen. (“Old enough to fight, old enough to vote”)

Almost unnoticed during all of this excitement, Bell Labs researcher Dennis Ritchie was creating a new general purpose programming language that he called C. This by itself wasn’t that exciting but C was used to write the first release of AT&T Unix.

I can sense I’m not exactly blowing your skirt up with this, but hear me out.

Prior to that time, computer operating systems (the software that runs the hardware) were written directly to the hardware using assembly language. An assembly language was very low-level code that produced software that would only run on a specific type of hardware. That meant that if you wanted to run Awesome OS (™) on a different type of computer, you had to completely rewrite the operating system. Needless to say, this slowed down innovation in the computer industry significantly.

Here’s my point.

C was the first high-level (ie. human-readable) programming language that could be used to write operating systems. The beauty of high-level languages is that as long as you have the original code, getting programs to run on different computer hardware is pretty easy.

Dennis RItchie, in short, was the father of the portable operating system.

The consequences of this were huge. Computers can’t run without an operating system and the difficulty of creating an operating system for new computer hardware was a serious limitation to computer hardware innovation. Ritchie’s work revolutionized the computer industry.

What does this have to do with Vala? True to its UNIX roots, GNOME was written in C. Now C is a solid reliable programming language (as evidenced by the fact that it’s still in use over four decades later). However, C doesn’t have the features of more modern languages and so for general purpose programming it imposes more and more limitations on the developer as the state of the art advances. They have to work harder just to stay in place.

Vala is based on a pretty clever idea. It has all of the snazzy bells and whistles you expect from a modern programming language so it’s easy for developers used to newer languages like C# to pick up.

But the Vala compiler converts Vala code to C code which is then compiled into just another GNOME application. That’s why you don’t need to install any extra software or libraries to run programs written with Vala.


Once you have the Vala compiler installed, all you really need to start writing code is a text editor. I installed Vala using MacPorts and I’m going to use TextWrangler to write my code.

A basic Hello World program in Vala looks like this (courtesy of the GNOME Vala tutorial):

int main () {
   print ("Hello World\n");
   return 0;


Compare this to the same program (courtesy of the Content Creation Wiki) written in C ( and Vala reveals its roots:

#include <stdio.h>
#include <stdlib.h>

 int main(void)
  printf("Hello, world\n");
  return EXIT_SUCCESS;

Now I just compile my code and run the program:

valac hello01.vala
Hello World

Pretty straightforward, but not very modern. Let’s jazz it up a bit using some modern paradigms (courtesy of Dream.In.Code):

using GLib; // not required
public class HelloObject : GLib.Object {
   public static int main(string[] args) {
       stdout.printf("Hello World!\n");
       return 0;

It still works:

valac hello02.vala
Hello World!

The Vala Project has created a programming language that both embraces modern development techniques and honors its roots.

#Review – The Art of Unix Programming

There is a vast difference between knowledge and expertise. Knowledge lets you deduce the right thing to do; expertise makes the right thing a reflex, hardly requiring conscious thought at all.

I was introduced to Unix in 1986. I was working at AT&T as a communications technician and my operations manager had just gotten hold of three 3B2 minicomputers. I was tapped to do something useful with them. So I bought a copy of Unix System V Bible, plugged a serial terminal into one of the 3B2s and started learning.

I still have that book, by the way.

This was my introduction to Unix. It was also my introduction to the Unix culture, and the wider world of the Open Source software movement.

Eric S. Raymond is one of the most eloquent supporters of Open Source. His book The Cathedral and the Bazaar was a seminal work on the emerging information economy and the changing model of software development. As Cathedral was a work of philosophy, Raymond’s The Art of Unix Programming was about practice.

As I’ve said before, I’m not a professional programmer. I write code for fun and to build tools for other work. I teach programming. I blog about programming. I read about programming. These are just some of the reasons that Eric Raymond’s book has a permanent place on my bookshelf.

Another reason is that Raymond is a damn good writer. He’s engaging, passionate and smart without being condescending. This book is nominally about writing Unix programs but on a higher level it’s a treatise on software design. Raymond uses Unix as a jumping-off point to discuss the larger topic of writing good software.

It’s not about a particular programming language. You can write Unix programs in any language you like.

One of my favorite sections is “Basics of the Unix Philosophy” where he lays out the rules of design for good code. From the Rule of Modularity (“Write simple parts connected by clean interfaces”) to the Rule of Extensibility (“Design for the future, because it will be here sooner than you think.”), they all represent solid advice for designing code with any language on any platform. I’ve tried to incorporate these rules in my own code.

In addition to offering guidance for current and would-be programmers, there is a section on design principles, including Modularity, Textuality and Interfaces. Naturally, there are copious references to Open Source, including a discussion of software licensing and best practices.

But it’s not all sunshine and relentless boosterism. Raymond takes a clear-eyed look at the problems with Unix culture and problems in Unix design. Bonus features include a section called ‘Rootless Root’, a parody of Zen philosophy complete with Unix koans and copious examples of code demonstrating the principles that Raymond outlines the book.

The Art of Unix Programming is not just a good book for coders but for anyone who enjoys reading about the philosophy of design.



Raymond, Eric S. The Art of Unix programming. Addison-Wesley Professional, 2003.