Decidedly Jazz


April 8, 2016

Recently came across a discussion on Twitter about how programming was part math and part jazz. The jazz part, of course, is about improvisation. I don’t know, maybe we are all comedians?

Ok, the basics of the theory are like this. We use basic building blocks, like musicians do, in order to build programs. These building blocks are called “design patterns”. Just like music, we know that programs can be built without using design patterns, but they are generally more pleasing to read and understand if we do use them. These patterns are recognisable to other programmers with the same training and understanding.

I remember attending the Toronto Jazz Festival, with my uncle, Don Vickery, who happens to be a talented jazz drummer and teacher. There was a French band up on the stage in front of city hall, that was… undoubtedly skilled and technically proficient. But after a glance in my direction, my uncle leaned over towards me and said, “Yup, my toe is tapping to that one.” In case it’s not obvious to you, that was sarcasm. Technical proficiency does not necessarily produce enjoyable music. I’ve seen the same thing in code. A talented programmer can write amazingly complex code to solve difficult problems, but that doesn’t mean her code is easily readable or even understandable to novice programmers.

Everyone who programs is building something with their mind. Like music, it may be a common melody, that tens or hundreds of composers have used before. Or it may be the craziest new thing ever, that is totally unique to that programmer.

Of course, that is the beauty of building things with your mind. Everyone’s mind works differently. We have schools of thought in programming, much like schools of music. The programs written by people of a specific school will tend to be similar, and will definitely be more understandable to people of the same school.

But there is value in these differences. I teach a couple of workshops, and I find the endless variations that my students come up with to solve the problems presented as exercises fascinating. In two different workshops, I had a couple of sysadmins. They both approached one of the problems (loading a file which had a couple of errors in it) in a way that was similar to each other, but totally unique compared to the rest of the class of primarily web developers. Their minds work at solving these problems differently, because they have a different background and training, and the design patterns they commonly use in their work are different from the ones that web developers commonly use. That does not mean that their solutions are better or worse than the solutions of their fellow classmates. They were just different.

That’s part of what makes programming so interesting. You can be trying to solve a problem, and bring in a coworker or pair to help out, and discover a completely new way to approach the problem, because your pair just thinks different. That’s incredibly valuable, and programmers who are “lone wolves” never experience this sort of revelation.

One of the strengths that I seem to bring to the table is that I can approach a problem from many different sides and points of view. Sure, sometimes I get stuck, everyone does. But having the flexibility to recognise that there is more than one approach, and having the mindset that allows me to flip from one to another to another is part of what makes me a good programmer. And, I think, a good teacher. If all you know is one way, and one of your students just “doesn’t get it”, because their mind doesn’t work the same way as yours, it will result in an impasse, and a failure to teach. It’s not a failure to learn, just because their mind works differently. As a teacher, you should open yourself to all the possible variations of solutions, so that when you encounter one of those students, you have other options to use, in order to help that student achieve understanding.

And yes, the title of this post IS an homage to the Decidedly Jazz Danceworks professional dance company of my former home, Calgary.