Peter Evans

A few weeks ago, I found a real gem on GitHub: an archive of the the source code from the Berkeley Software Distribution (BSD) of Unix, as of June, 1995. It was produced from the commit history of a very old repository maintained in an yet older–possibly, the first!–version control system, SCCS. All 69,978 commits are there, plus one to add a README file in 2012 by the GitHub user who maintains the archive.

If you want, you can check out how some simple C programs were written for everyday Unix tools like mkdir and cat. Or maybe the C version of the very first text adventure, adventure (née ADVENT), or of rogue, the procedurally-generated RPG that came to define the genre of roguelikes.

I remember, when 17, a friend lent me a copy of FreeBSD to install on my machine. Included was a CD of source code, just like what you find in this repository. Having just graduated and with a summer off until college, I had all the time in the world, it seemed. And I had taken a class on C in my senior year.

The code I wrote in that class wasn’t anything like the code I found in all that source code, a lot of which was derived from this archive. Ohh, I thought; they don’t use char arrays for strings, they use pointers. I had no idea–we weren’t taught to work like that. I thought, I guess this is how real programmers wrote C code, and I’d need to adapt.

Really, thinking back to that time, it was the first time that programming clicked for me. I’d been so interested in it, for so long; I’d taken classes in school on Basic, on Pascal, and then C. I knew enough Assembly to crash my computer. I had to stare at this code, stare at any code, long enough for me to put together a mental model. You call this, then this does that, you increment the pointer, you set the NUL character at the end … pieces falling into place.

I’m a fervent believer that, given opportunity and given time, people can learn what they set their mind to. There’s more than one way to learn how to program, more than one way to work with code–I couldn’t say that mine is the best and only way! For me, however, it came down to finding the right abstraction that inspired me, something that wasn’t evident until I thought of using char * pointers instead of char[] arrays to work with strings.