The King of Instruments

Recently a good friend of mine asked if I was still learning to play the piano. I responded that I wasn’t really, but that I’ve been playing the organ instead. He asked if that was any different, and this forced me to think back to a few short months ago when I would have had the same question.

It would be easiest to start with how the two instruments are the same. It’s important to remember that the organ predates the piano by hundreds of years. The piano has become much more popular, in large part due to the fact that they are much cheaper and more portable (though portable pipe organs did and do exist, the large ones are actually built in to their locations). But the layout of the piano keyboard was based on the organ keyboard, and thus the biggest similarity becomes apparent: they both have keys laid out in the same way, with groups of 2 and 3 black keys.

A pianist at work

A pianist at work

In similar fashion, they can use the same written music–and for this reason, most organ teachers require that some years have been spent learning to sight-read the grand staff on a piano. (Sheet music for organ generally adds still another staff, another bass clef for pedal notes, but this is not always the case.)

That about wraps up the similarities. To note some of the differences, it is helpful to have a basic idea of how the piano and organ work. I’ll start with the piano, because they are largely standardized: compared to organs, one piano differs from another very little.

Pianos always have 88 keys and 3 pedals (or sometimes only two pedals on inexpensive models). As you can see if you open the top of a piano, it is a string instrument whose sound is produced by little felt-covered hammers that strike when you press a key. The strings are laid out from long to short; hitting a longer string makes a lower sound. If you press harder, the hammer strikes harder, so in effect you have control over how loud or soft a given note is, just by touch.

In fact, each hammer strikes multiple strings per single keypress, to give a fuller sound. If you hold down the leftmost pedal with your foot, you will see the hammers offset themselves, thereby striking less strings per stroke.

The other two pedals have to do with the dampers–the mechanism for preventing strings from continuing to vibrate after they are struck. Especially common is the rightmost pedal, which lifts all the dampers, allowing the strings to vibrate freely and sustain their sound much longer. Use of this pedal is important to a piano player to achieve legato, or a smooth, connected sound between notes.

Organ manuals

Organ manuals

An organ, on the other hand, is a different beast. It’s not a string instrument at all, but rather produces sound by moving air through pipes. There is great variety among organs, but they generally have at least two keyboards (called manuals) that you play with your hands, and a pedalboard that you play with your feet (certain portable or very old models may lack the pedalboard or only have one keyboard). The manuals are usually smaller than the piano keyboard by a couple octaves, and the pedalboard has about half the number of notes as a manual (note that the pedalboard is laid out with the same configuration of “white and black” notes).

Example of playing with hands and feet. (Sound in video is quiet; turn it up.)

If you just walk up to an organ no one has messed with and press a key, it will make no sound. This is because you have to tell the instrument which pipes you want to play. You do this by activating levers or buttons called stops. Each stop controls access to a given range of pipes. If the stop isn’t activated, air is not allowed to pass into those pipes.

Pipes are, as you might guess, arranged such that there’s a different pipe for each note. The lower the note, the bigger the pipe. A group of pipes that have the same type of sound and range from the lowest note to the highest is called a rank. Thus, when you pull one stop, you are activating one rank of pipes. If you activate two stops, then two ranks are allowed air, and therefore pressing just one key on a keyboard can actually cause more than one pipe to sound simultaneously.

Ooo... pretty pipes!

Ooo... pretty pipes!

This is important, because different ranks of pipes produce different kinds of sounds and different levels of pitch. For example, it’s common to make it so that pressing a key plays the chosen note (say, an A) as well as the pitch that’s an octave above that note (the next higher A). This gives a nice fullness of sound; think about a choir singing in unison: they are singing the same notes, but at different octaves and with different tone qualities, and it provides a more interesting sound than just a group of sopranos.

Similarly, you can activate ranks that will harmonize with the current notes you’re playing. There are also ranks of pipes that emulate different sorts of instruments, like flutes or trumpets. As a result, the organist has much more control over the sound of the instrument than a pianist.

However, due to the difference in how the organ makes its sounds, you can’t make it play louder or softer merely by pressing the keys harder or softer. The pipes are either playing, or they’re not. This means the techniques you use to play an organ differ quite a bit from a piano. Also, the pipes sound for as long as a key is held down, but absolutely no longer. This means that, unlike on a piano, you can hold a note down and it will sound for as long as you want. On the other hand, to achieve legato or a smooth connectedness between notes, you have to play a lot more precisely: you don’t have a damper pedal to do it for you.

vdExample of dynamics on an organ

So, as an organist, you have two ways of controlling how loud or soft your sound is. The main way is, you just activate either more or less pipes. Makes sense, right? But there’s another way: some pipes are always located behind shutters. You can control how open or closed those shutters are with a big foot pedal. So although the pipes themselves always produce the same volume, you have control over how much of that volume reaches the listener.

Shutters in front of pipes - shown here open

Shutters in front of pipes - shown here open

Anyway, I hope that serves as a bit of an introduction to the organ. It’s a complex instrument, and one that allows you tremendous control over your sound (which appeals to my gadget-geek nature as well as my creativity). It allows you to make use of all your limbs, giving you access to a whole other melodic line over that of a piano. And it has a unique history and repertory of music behind it. In summary, prepare to get organized.

So… Where Do I Begin?

Previously I made the claim that learning a language affects how you think. Here’s my take on what you might want to try, if you are thinking about picking up programming.

This article, while designed for someone who hasn’t yet started programming, must needs contain some technical terminology. I originally considered littering the text with footnotes, but who likes reading footnotes? (Unless they’re written by Dave Barry, of course!) Instead, read this glossary thingy first, which should serve a as a mild introduction to some basic “lingo.”

This is obviously going to be for a very specialized audience–the intersection of the set of people who read my blog and the set of people who aren’t programmers but could see themselves maybe becoming one someday. Hopefully it will be at least mildly interesting to those of us who don’t belong to the empty set :)

My reasoning behind my suggestions is based on equipping you not only with a tool that will help you accomplish some task, but that will stimulate you intellectually and help you think about programming. It will also hopefully provide a solid foundation that you can build upon so that you will find it easier to program in future languages you may learn (perhaps ones that are more task-oriented).

As such, I will start with some I think you should not learn as your first language, and why. Obviously, I’m not saying you should never learn these (quite the opposite in the case of some); just that they maybe shouldn’t come first.

  • C – An excellent language, and incredibly useful (still today one of the most-used languages in spite of its simplicity). It also has a small syntax and standard library, making learning it on a superficial level quite easy. However, based on the criteria I mentioned above, I cannot recommend it as a first language. It lacks too many helpful abstractions, and indeed tends to force you into pretty specific coding styles. This is a pity, because I’d really love to recommend it on the virtue of what it teaches you about how many other programming languages work “under the hood.” Learn it second!
  • C++ – Built off C, C++ had the aim to deal with the aforementioned lack of abstraction–in other words, just as you don’t need to know how a car works to drive one, you shouldn’t necessarily have to know how a computer works to write programs for it–but still be compatible with C code. It became quite popular in its day, and indeed there is still an enormous amount of programs written in C++ around. However, while I applaud its goals, its execution is lacking. It’s ridiculously complicated in about every way you can think of, and when you combine that with the lack of any training wheels or even safety belt (a wrong move can crash your program or corrupt data, and often it is unable to tell you why)… you’re asking for trouble. There are certainly C++ zealots around, but I’m just as certainly not the only one who thinks that learning it well is not worth the titanic time investment.
  • Java – Many people will disagree with my putting Java on the not-learn-first list; indeed it’s the one they teach you first at BYU and lots of other schools (although only ones striving to be “practical”–Computer Science programs that take a more academic approach tend to use other example languages). Java came along as an answer to the madness that was/is C++, and became very popular in the business world. I reckon it’s still the Biggun’. One of its most interesting features is that it is cross-platform–that is, your program will run on Windows, Mac OS X, Linux, etc. (This is not a typical thing!)

    I say don’t learn Java first, because quite frankly of the Java-like languages it’s not the best. It lacks some features and is quite verbose; you end up writing a lot of boiler-plate code all the time. I can also say that from personal experience, if you learn it first, it makes you think “in Java.” And in hindsight, that’s not how I want to think :)

  • Javascript and PHP – Two good languages, and ones you more-likely-than-not will learn eventually. I don’t recommend them as first languages for a couple reasons. For one thing, they are very loosely typed–this means they are very willing to “try and guess what you meant.” This is a pro as well as a con, but I think you will appreciate it more–and it will bite you in the butt less–when you have some experience under your belt and you actually understand what “loosely typed” means and how it applies to code you write. Another reason to steer clear of them is that they are almost the trademark “newbie languages.” This has a number of implications:
    • No real community to speak of. Most of the people who program in them do so not out of a love for the language, but out of desire to get something done quick. The “community” is a lot of people who would be new like you–and when you’re new to a language, I’ve found it’s helpful to know where to find experienced people.
    • Lots of code for these languages that’s out there on the internet–both example code and libraries (that is, code that others have written to perform a task so you don’t have to write it) are written by people new like you. Again, as a newbie programmer, you want to learn from and use code that is as close to professional quality as possible.
    • Security gotchas. Though this kind of thing does of course get better as time goes on, rapscallions are well aware that code in these languages is both very popular and often written naively. Thus if there are vulnerabilities, they are going to be found out and exploited.
    • General lack of emphasis on proper coding style, algorithms, etc. As very permissive languages, they permit you to write steaming piles of… code.
  • Perl – I have a soft spot for Perl, but as one of the most organic languages out there, it has become a bit overgrown with decade-old weeds. Additionally, it has a lot of subtlety and complexity, and lots of syntax. Unlike C++, it can’t wreak havoc on your whole system, but I have accidentally erased files before by getting the file-opening syntax wrong. (I know that came off as anecdotal FUD, but I was merely listing an example. Again, I like the language, in spite of its quirks.)

    Perl has a dedicated and experienced community behind it, that I’ve found to be helpful and excellent. It’s also got probably the largest collection of freely-available libraries of any language out there. But in reality, I wouldn’t recommend it as a first language, and even as a second language I’d recommend waiting for its next incarnation to come out (which has been in the works for many years now. The language’s designer recognized that Perl needed a complete rewrite, and so it’s taking awhile).

  • Visual Basic – If we were speaking of “classic ASP” or Visual Basic 6, all of the above commentary would apply, and then some. Nowadays, however, you’d be more likely to encounter VB.NET, which is built on the .NET framework and (though I’m overgeneralizing) is essentially a way to write the same code as you could in C#, but with different syntax. However, that being said, there are no benefits to doing so, and the code you write is both ugly and dissimilar to any good language. So there’s simply not a reason to start here.

I believe that about covers the most common starting points for a new programmer that I wouldn’t endorse. There may be others, but I don’t feel qualified to comment on languages that I myself haven’t learned to at least some degree.

Anyway, the more interesting stuff: what do you learn, then? Haven’t I just ruled out like every popular language?

Well, understand it is quite random which languages end up becoming popular; indeed, the only thing they really have in common is that they are generally not the best of their kind–or even if they were originally, others took what they did right and combined them with other stuff done better.

Assuming you fall into my target audience (you want to learn what will be helpful in the long run, recognizing that as a brand new programmer you won’t be writing 3D games and huge financial systems for a while anyway), you are have lots of pretty good options available. Here’s a list! I’m going to put it in order of “amount of brain-stretching required”–you can decide for yourself, based on your various capabilities, which might work best for you.

  • C# – I’m a tad hesitant to recommend this as a first language. It was my first language, and it is a good language, yadda yadda. Syntactically, you can think of it as a significantly better version of Java: it has several constructs that Java doesn’t, making it much nicer to code in. It’s also got tremendous IDE support, which I think is good and bad as a programmer seeking to learn the ropes (but that’s a topic for a different blog). And when it all comes down to it, it will get you in a mode of thinking that is similar to a Java programmer’s: somewhat roundabout, somewhat repetitive, somewhat verbose.

    If you do choose C#, try and take advantage of the features that new versions have offered, and continue to make a great effort to do so as future versions are released. One of its big advantages over Java is it continues to introduce solid ideas from other languages every couple years. Note that it isn’t strictly Windows-only anymore; the effort to get it on other platforms has been actually quite successful.

  • D – I’m going to make an exception to my rule here, and list a language I’ve never learned. I do so because D is one of the languages I’ve only ever heard good things about–which is rare in the world of programming languages. D is, in short, what C++ should have been (or should be). It’s even designed to be able to fill that close-to-the-machine niche if needed. If you learn it, let me know how it goes!
  • Python – This is probably the most popular language out there that is the most solid and straightforward. It was designed to avoid trickiness and to be very uniform; indeed, their motto (paraphrased) is “There should be one way to do things.” This even includes how the code looks on a piece of paper: all very uniform. There are lots of newbie resources available, tons of example projects written in good style that you can study, and plenty of libraries to help you do all sorts of stuff.

    With as much praise as I have for it, I’m actually not the hugest fan of the language, simply because I tend to prefer a system that allows for a bit more cleverness. (There are also some aesthetic quibbles I have with it.) But you could do a lot worse than learning Python first. It will especially help with getting you in the habit of writing well-formed code, in any language.

  • Ruby – Ruby is similar to Python in some ways, but different in philosophy and in the sort of coder it tends to attract. It was my favorite language for a long time, and I think it scales well: you can start by writing in Python-like style, and as you learn new tricks, incorporate them. The result is both simple and concise. It commonly uses certain programming constructs that, while they may exist in a language like C#, don’t play as big a role–therefore in Ruby you get to appreciate their power more frequently and understand them sooner.

    Ruby was also designed with “metaprogramming” in mind–that is, you can play with how the language works. This isn’t really important to know as a newbie; I mention it as part of showing that there’s definitely “growing room” for your brain as you learn this language.
    Note: Don’t confuse Ruby with “Ruby on Rails,” which is a framework written in Ruby. I don’t recommend jumping into Rails right off the bat, without learning Ruby first.

  • Scheme – Scheme is a great little language, unfettered by frivolous syntax and unnecessary complexity. It is a “Lisp,” meaning one of a family of languages that share an important trait: they are incredibly easy for humans and computers to parse. This means you can easily write code that writes code. Programming in a Lisp is very fun if you don’t mind stretching your brain a bit–and I’m writing this blog for those that don’t.

    One nice thing about Scheme, is it is used as the example language in several books about how to learn programming the right way. (Most programming books are closer to either “how to learn Language X the right way” or “how to do task X with Language X”.) Also great is a couple of these books are free: SICP and How to Design Programs. I also recommend The Little Schemer.

  • Haskell – I’m learning Haskell now, and consider it to be the closest thing out there to the “holy grail” of languages. It’s incredibly well-designed, and is packed with cool features, and it has one of the most helpful communities I’ve yet encountered. It’s also the most brain-stretching of any language I’ve mentioned on this page. Though I’m sure some would disagree with me, I am of the opinion that it was designed by smart people, for smart people. Or, that is to say, that smart people will be able to harness it best. (Standard disclaimer about not measuring your self-worth by whether you can code in Haskell, yadda yadda [even though I personally measure my self-worth by everything I can't do... but that's for another blog.]

    I just mean that there is a lot you can do with a language like it if you have the tools upstairs, unlike, say, PHP–which is like “programming to the lowest common denominator.”) I won’t launch into any significant description of the language here, as someday I plan on writing about it more–hopefully in a fairly approachable way.

Of course, there are many other good languages out there. Again, I’m a bit limited by what I’ve had time to digest personally. Also, some languages are worth learning, but perhaps not first. Let your intuition guide you–learning a language should be fun and interesting, and if it’s not, something is going wrong. If you absolutely aren’t enjoying one of my recommendations, don’t let that turn you away from programming in general; by all means give something else a shot.

I’m only able to speak out of hindsight, and indeed it’s probably that warped kind of hindsight wherein if you went back to your old self and gave him advice, he’d probably just look at you funny. But such is life, and such is programming.