Beer++
I drank beer in college. I learned C in college. After I graduated I stopped doing both. Now I have begun using C++ and drinking beer again. Coincidence?
I started college in 1995 to get a computer science degree. I remember sitting in my dorm room the first night. Someone offered me a beer and I drank it, feeling sort of independent for the first time. Of course, like most college kids, I had some bad experiences with alcohol. By the time I turned twenty-one I had stopped drinking.
At college I also began learning Ansi C. To briefly explain, in the early seventies, some programmers at Bell Labs created the C programming language. They wanted a small and powerful language which could run on a wide variety of computers. It quickly became popular, and remains in use to this day. This eventually became standardized as Ansi C.
To me C felt clunky and wrong. Nothing I wrote ever seemed to work as I had envisioned. I could program in several other languages, but for some reason I just couldn’t quite get the hang of C. Having someone else teach it to me could have something to do with it. I tend to learn better on my own. And yes, alcohol may have also played a part.
I have a funny memory of having rather a lot to drink and going on IRC. I started chatting with a random guy who it turned out also took a C programming class. He had trouble with some things which I understood, so I offered to write the program for him. I told him he just had to do me one favor: to remind me to get water every ten minutes or so. The arrangement worked out and I wrote the program. I don’t remember much else.
A year or two later I stopped going to college, programming in C, and drinking alcohol. I felt fine with my choices. College sucked. C confused me. Alcohol made me sick. Then, a few months ago I moved into the city. I have come to the conclusion that one has to drink beer to live in Philadelphia. We have lots of microbreweries around, and Hawthorne’s Cafe has the best beer selection in the area.
I first realized this at a block party. Let me tell you that the block parties around here blow the block parties in Swarthmore away. They had cordoned off a street right by the cafe, and everyone hung around listening to an American wanna-be reggae band in the lovely May sun. A friend asked if I wanted a beer. I said I didn’t really know, but he works at a beer distributer and said he’d find me one I’d like. He gave me Daisy Cutter. I really enjoyed it, and it even gave me a little buzz. It made me begin to rethink my view on beer.
Meanwhile, I realized I needed to get comfortable with C on some level. It has some real advantages. It allows one to easily compile a program to provide a simple executable file anyone can run without anything extra. It also allows for easy linking with common libraries of code. I began trying to figure out how to pick up where I left off. I hoped that teaching myself would make it easier.
I quickly realized that C++ had become very popular. In the late seventies a new type of C began to emerge. It used principles of object oriented programming, something I’ve thought about before. It makes coding real-world problems easier, since it allows one to create a data structure with functions associated with it. In C, the ++ operator increments a variable. Thus, C++ suggests incrementing the language to the next level.
Everything came back to me, plus now I had the added benefit of understanding objects from other languages, especially Ruby. It feels like they took all the things that annoyed me about C and did their best to fix them within the confines of the language. I think they have done a good job. For example, Ansi C didn’t even have a dedicated way to deal with strings of characters. It saw them merely as an array or list of individual characters, and had functions to operate on these arrays. C++ has an object class for strings, which includes all the luxuries of more modern programming languages. Vectors and maps give dynamic arrays and hashes. This means less mucking around with pointers, something I welcomed. Now I have a grip on C++ and I feel good.
In just a few months I have rethought my views on C and beer. I prefer good beer, and I know not to drink too much. I don’t want to get too messed up. I prefer C++, and I know not to use old Ansi C ways of doing things too much. I don’t want my programs to get too messed up. It would appear that programming in C and drinking beer have a positive correlation. And for those who might feel shocked that I would reinvent myself like this, I can only say: All hail Discordia!