Explore the code

At some point in the last few years strange things started happening in life. Like really  strange things. Strange along the lines me deciding to get a degree in electrical engineering. And it didn’t just stop there either. Somehow I got talked into applying to some of the top Computer Science graduate programs in the world and for some reason I actually got accepted into one. Even though by day I’m a starving graduate student heading towards some amount of respectability as a computer scientist, the deep, dark truth is that inside I’m just kid who likes slinging code to build cool stuff. And there’s an awful lot of cool stuff waiting to be built.

The greatest thing about working with software is the immense flexibility that it offers. We are quite literally building structures with pure thought. Of course, our thought gets manifested as lines of code, functions, classes, modules, type systems, so and so forth. And all that gets compiled down to ones and zeros which in turn become little groups of electrons flowing (or not flowing) through unimaginably small, real, physical structures made of semiconducting materials. The magic of computer technology is that I can easily ignore all those layers and easily spin my thoughts into increasingly complex and intricate webs. And that is wonderful.

I’m currently listening to “Christofori’s Dream” by David Lanz on Pandora. It’s a quite beautiful piano piece (though I’m no real judge of piano pieces) and I can’t help but think that programming is quite similar to music (and writing and painting, you get the drift). But the one advantage we programmers have is that our instruments are quite literally limitless — if a problem can be solved in a finite, reasonable amount of time we have the tools in our hands to solve it. That’s like having instruments capable of creating all possible musical sounds (given an suitable definition of musical). Now that doesn’t mean that it’s easy (any more than owning a violin means that you can play it) or that all instruments are created equal. Again, one more strength of computing over music performance is that it so much easier to create our own instruments if need be — oftentimes building atop other, less sophisticated instruments. Please keep in mind that I know very little about music (I played classical Indian violin for a while, but that’s about it) so if you know about computers and music (or just music) and think I’m talking crap, please have at it in the comments.

Before getting distracted by Pandora I was going to say that rapid experimentation is one of the really cool things about programming. You can write a line of code and in an instant see the computer carrying out your code. Hell, these days you don’t even need any actual programming tools installed — you just need a browser. I think that as we go from being teenagers making computers do cool stuff to “software engineers” and “computer scientists” we start to think that we are bound to use our powerful machines to solve important, large problems (or at least problems we’ll get paid to solve). At times like this, it’s worth remembering the wise words of Alan J. Perlis, one of the early pioneers of our field –

I hope the field of computer science never loses its sense of fun. Above all, I hope we don’t become missionaries. Don’t feel as if you’re Bible salesmen. The world has too many of those already.

There’s more on the about page. Sure there are important problems that need solving and we need our machines to help otherwise we’ll never get them done in time. However, there’s a lot of fun to be had on the way. We can sequence the human genome and model the birth of the Universe. But we can also create music, art, poetry, games and just general neat hacks that fill people with a sense of wonder.

At the beginning of Star Trek: Insurrection Captain Picard says, “T remember a time when we used to be explorers”. That time is now. Computers are powerful tools and instruments, but they are also amazing vehicles for exploring the spaces of the mind. While we’re off solving important problems and making tons of money let’s take some time off to kick back, pick up a keyboard, write some code and just wait and see where it takes us.

Keep exploring.

Languages abound

After almost a month and a half I’m back in a position to write The ByteBaker on a regular basis again. Instead of a lengthy explanation and reintroduction, I’m going to dive right in.

At the end of August I’m going to be starting my PhD program in Computer Science at Cornell University. Over the last few years of college I’ve developed an interest in programming languages and so I’m spending the next few years pursuing that interest (and hopefully writing some good software in the process). Programming languages are an intensely mathematical and logical area of study. In fact, I’ll admit that I am a bit intimidated by the amount of knowledge about the logical foundations of PL I’ll have to gather before being able to make a meaningful contribution. But on a personal level, it’s not really the mathematical rigor or the logical elegance of these systems that I find interesting. For me, programming languages, just like real languages, are a medium of expression.

In the end, what we’re really trying to do is express ourselves. We start by expressing the problems we want to solve. If we do it well, (and our languages are expressive enough) the expression of the problem leads to the solution. If we do it not-so-well, or if the problem is particularly complicated, we have to express the solution explicitly. In addition to problems and solutions, we can express ideas, data, relationships between data and complex interacting systems of relationships and data. Again, the greater the expressive power of our languages, the easier our job becomes. We want to express the way information should flow through our system. We want to constrain what relationships and flows are possible. We want to specify the dependencies (and independencies) between parts of our systems, we’d like to build our systems out of well-defined components that behave according to fixed and automatically enforced rules.

Just as there are a infinity of things we’d like to say, there are a multitude of languages to speak in. And just as we want to choose the right tool for the job we also want the language that gives us the right level of expressiveness. That’s not to say that there is a linear scale of expressiveness. At one level all Turing-complete languages let you say the same things — if you’re willing to bend over backwards to varying extents. Some languages allow us to say more things and with less efforts than others. But some languages just let us say different things. And even though you could twist and turn almost any language to say almost any thing, I’ve come to feel that all languages have a character — a set of assumptions, principles and decisions at the core that affects how the language and systems built with it work.

Languages don’t stand on their own. And despite my love of languages for themselves, they’re only as important as the systems we built with them. Human languages are important and beautiful in and of themselves, but they’re far more important because of the stories, histories and wisdom they embody and allow to be expressed and recorded. Our computer languages are valuable because they let us express important thoughts, let us solve important problems and built powerful systems to make our lives better. Again, we have done great things with the most primitive of tools, but if you value your time and energy it’s a good idea to pick the right tool for the job.

Personally, I’ve always been something of a language dabbler, probably a result of being in college and needing to move to a different language for another course every few months. In my time, the languages I’ve done significant amounts of work are C, C++, Java, Python, Ruby, various assemblers and Verilog (not a programming language per se, but a medium for expression nonetheless). I wouldn’t consider myself an expert in any of them but I can definitely hold my own in C and Python, maybe Ruby too if I had to. Then there are the languages I want to learn — Lisp in general (Scheme in particular) and more recently Haskell and Scala (a newly discovered appreciation of functional programming and strong type systems). They’re all different mediums of expression each letting you say different things and there’s certainly a lot I want to say.

As a PhD student in programming languages, my job is not to become an expert in different languages (though I guess that could lead to an awesome consulting gig). My job is eventually to make some contribution to the field and push the boundaries (and that involves convincing the people standing on the boundary that it actually has been pushed). Luckily for me there are definitely lots of ways in which the state of the art for programming languages can be pushed. However, to do that I first need to know where the state of the art currently lies. Over the next few months (years?) I want to get deeper into studying languages and the ideas behind them. To start off, I want to explore functional programming, type systems and macros. And I’m sure those roads will lead to more roads to explore. Yes, you are all invited along for the ride.