« Scaffolding | Main | GDC 2011 - Wednesday, Part 1 »

March 05, 2011


Jacques tied the apron around his waist as he finished surveying the ingredients in front of him.

“You know, Dad, I’ve always wondered why you keep so many knives.” His daughter Claudine had come up behind him while he was collecting materials for dinner. “Can’t you just have one or two? I mean, you have several knives even at the same length!”

“Oh, hi, Claudine. Pour yourself a glass of wine and a little more for me, and I’ll answer that as best I can.”

As Claudine poured Bordeaux into two glasses, Jacques picked out several short-bladed knives and moved some raw foodstuffs to a nearby cutting board.

“Now, see here, Claudine. I’ve taken many of my three-inch blades and laid them out here before you. Can you see any obvious differences?”

“Sure. That one there has a serrated edge, that one has a weird curve to the blade, and that one looks a little like your big chef’s knife.”

“Very good, Claudine. Each is different.”

“But why do you need all of those?”

“Well, each of these is better at a different sort of job. That serrated one you mentioned is particularly good for cutting tomatoes, or perhaps sausage. Its wavy edge allows it to slice cleanly into something that is a little bit soft in the center but has an outer skin. You see?” He sliced cleanly into a tomato, slicing it very thinly indeed.

“What about this curved one?”

“That’s a great tool for peeling fruits and vegetables -- the curve of the blade fits to the curve of the fruit.”

“And this one with the wedge point?”

“For removing the eyes of potatoes.” He demonstrated deftly, with a flick of his wrist.

“But couldn’t you do all of these tasks with any old knife? I’ve seen you make full meals with just your chef’s knife, especially when we’ve been vacationing.”

“Oh, certainly I could, Claudine. Most knives are good at doing many things, but these other knives are particularly good at doing one thing. And that lets me move a little more quickly in the kitchen, or make something just a little bit better. For example, when I use the serrated knife to cut tomatoes, it’s much easier to do so without bruising the fruit where the knife goes in.”

“Oh! Didn’t it take you time to learn to use all of these?”

“Well, of course, Claudine. It’s taken you a long time to learn the proper glass to use for each type of wine you drink, and why, n’est-ce pas? With knives, it is much the same thing -- I have some basic skills I use again and again, but I have to tell you, getting familiar with a new blade is such a pleasure.”

“A pleasure? I know you love to cook, but why such a pleasure from this specifically?”

“Well, each knife I’ve come to know has changed how I look at the ingredients I use for my cooking. I might realize that there are ways to look at preparing foods I’ve prepared before just a little bit better, or come up with a new way of thinking about a dish. Perhaps I can slice something thinner, and get a subtler flavor.”

“Does it make you a better cook?”

“Having more equipment doesn’t make me better in the kitchen, I don’t think. But it does let me use my skills in more ways, which might make me capable of doing more things, or doing some of them a little better. Being a good chef is in the soul and the hands and the senses. Now shoo, if we’re to eat tonight I’d better focus.”

“May I help?”

“Absolument. Take this serrated bread knife and cut that baguette on a diagonal...”

Today I want to talk a little bit about the very fundamental tools of programming: the languages themselves and some ways in which I’ve come to view these languages over the past few years.

When I began programming professionally, I spent a great deal of effort becoming proficient with C++¹, reading as much as I could and attempting to apply new techniques to problems as I encountered them. I learned from experience and the wisdom of those around me, and I would say that I had learned many of the fundamentals of programming. In the little parable above, this is like learning to use a single knife² proficiently -- one learns many techniques that will allow you to prepare ingredients in the service of your meals.

I spent a lot of years coding exclusively in C++. I read numberless books on the subject, designed systems in it, coded tools in it. It became the lens through which I viewed many problems in game development³. I refined my thinking about when certain types of approaches were appropriate, discarded that thinking in the face of new evidence, and rethought it all again and again.

But in the end, I started to become like a chef with only a single knife. It wasn’t the best tool for many jobs I would approach, but I didn’t have anything more specialized for the different tasks I would perform.

Over the past few years I’ve sought to remedy that. I’ve been re-reading and playing with LISP lately (via Abelson and Sussman’s classic), I learned a bit of javascript, some PHP, some of the latest version of Inform, and quite a lot of Python4. I wasn’t surprised that this made me a better programmer, really; having more tools is likely to make a better craftsman of anyone. But I was a little surprised that I feel it has made me a better C++ programmer.

The thing about learning new tools is that not only does it give you the ability to solve new problems in new ways, but it also changes what sort of problems you find yourself able to think about. Just as getting knives that have certain features, additional languages force you to rethink how you solve different problems, and being able to solve different problems grows your thinking altogether.

I can’t recommend enough trying some new languages, for any professional programmer. A few things have been helpful for me:

  • Learning by doing. Rather than attempt to read a bunch and apply what I know later, I try and sit down with a text editor and go -- referring constantly to the web. When learning Python, I put a book on my desk, pointed my browser at python.org, and fired up an interpreter.
  • Reading samples of substantial size. Taking apart a good-sized project is a great way to familiarize yourself with how programs are put together, and might suggest features you’re not aware are present. In playing with Javascript and the HTML5 canvas, it has been immensely helpful to be able to dig into Darius Kazemi’s ALES project, a platformer builder that runs in the browser.
  • Attacking “real” problems. Toy problems are useful for learning fundamentals of programming, but trying to solve a real development problem you have is useful for actually learning a language. Over the past few years I’ve built tools for work in python, presented data from those tools in PHP, and I’ve been coding up games in Inform7 and Javascript (with HTML5 canvas).

I think that’s about all I have on this subject for now. I hope you’ll go out and get yourself some spectacular new knives... and keep them sharp.

¹This is, I note, a process that continues to this day. I hope to be learning new things in whatever languages I use professionally to the day I die.
²Typically a chef’s knife, if one cooks in the Western tradition, or perhaps a butcher’s knife in the Eastern tradition. The Eastern version of a butcher’s knife is a lot more flexible and of greater utility than the one you see hacking away at cuts at your local butcher’s shop.
³Development process was the other lens I would apply, but that’s a whole different can of worms.
4Also a little bit of SQL, and yes, I’ve played around with C# from time to time. The former doesn’t really feel like a programming language like the others, its domain being so specific, and I’m not much of a fan of C#, though I think it also has its uses. In the case of C#, it’s enough like C++ to me to not feel like a new language at all. I’m also not fond of it being tied to a single platform.

Posted by Brett Douville at March 5, 2011 02:23 PM