A Call for Memorization

By Deane Barker on November 27, 2005

Someone (I don’t know who), said “Half of intelligence is knowing the answer. The other half is knowing where to find the answer.”

In today’s world, we all know how to find the answer. But has that made us less inclined to know the answer from memory?

Google has just exacerbated this, really. There are so many things related to my job as a PHP developer that I just don’t bother to remember because the answer is one search away.

For instance: PHP date formatting codes. I have to look them up every single time. It’s the same with any number of function calls and input parameters (PHP is a bad example, since it’s all over map, but still…).

My point is that the Web tends to make us lazy in terms of remembering things that we’d normally study and memorize. Why do that when you can find the answer online in 30 seconds?

But is it really 30 seconds? If I’m cranking through some code and I suddenly have to break out of it to look something up, I’ve lost the all-important “flow,” and I have to stop and collect my thoughts, not to mention switching windows and such. Contrast that to being able to code right though without even looking up or wasting a single memory cycle on the answer.

And how much extra code have you written just because you didn’t know there was a function that did exactly what you’re trying to do? Or that there was some rock-simple code structure that you should know, but don’t (but would instantly remember when you found it after 30 minutes of looking…)?

All of this is aggravated by the fact that relatively few of us have formal training, and those that do are often trained on a lot of theory and not rote memorization. But there’s a lot to be said for memorization.

I was watching “Harry Potter” the other day, and Alastor Moody asked a class of students, “Who can recite the three unforgiveable curses?” (Hermione could, that little brown-noser…)

Anyway, I suddenly envisioned myself sitting in a classroom and someone asking, “Who can tell me all the possible function calls for getting elements onto and off of the beginning or end of an array, complete with their input parameters and return values?”

Could I answer that? Maybe. Probably most of it. But how about this:

  • “What’s the format string for the PHP ‘date’ function to return ‘Sunday, November 27, 2005 at 9:26 PM’? You have three seconds.”

  • “Given a string of 1,000 comma-delimited words, turn it into a two-dimensional array sorted and grouped by the second letter of each word with dupes filtered out.”

  • “Fork the current process, run a shell command with the fork, then close it and provide the return value.” (Totally made this one up — not even sure if it’s possible.)

  • “What are all the possible PEAR modules to parse a text file into a data structure. What are the text formats and what structures do they return?”

  • “Name all the functions in PHP that either return or verify the data type of a given variable.”

  • “Design a data model for [insert scenario here] and write the DDL SQL for it. Longhand.”

Could you write perfect code for each of these without looking anything up? I hesitate to provide examples, because I know some of you could do these from memory, but you get the idea.

If your job depends on coding PHP every day, would you be better off if you concentrated just as much on memorization as you did on theory?

  • If you took 30 minutes every day to practice function calls and functional blocks of code from memory, would you be a better programmer?

  • Would you be more effective if you kept a set of flash cards in your pocket so that when you’re waiting in line at the post office, you could quiz yourself on the array keys for the $_SERVER global?

  • Should you reward yourself with something when you can write down the name of every single array function from memory? After that, give their input parameters. Then add their return values.

  • Given 1,000 of the one-line function descriptions in the official PHP documentation, would you be better at your job if you could match them with their function names? (That’d make a heckuva DHTML script…)

  • Would you find a better way to do things if you spent 30 minutes a day browsing through every function in one of the odd extensions that you’ve never used? (Memcache, anyone? Ming? Semaphores? CURL?)

Remember in college when you used to have to memorize a lot of stuff? Should you get back into that mode? Should we approach our profession with more of an academic bent than we do now? Do we disrespect our craft by not bothering to do this?

I think you’d be a better programmer for doing this. Like it or not, unless you’re a lofty “software engineer” who doesn’t write code, a lot of what we programmers do is rote memorization.

In order to build better software, you need to remove friction. And friction is not knowing exactly what tools you have in the shed, not knowing what all of them do, and having to drop everything to go look things up when you forget.

In saying all of this, let me repeat that I’m just as bad as everyone else (probably worse). But I’m willing to try and get better at it.

Gadgetopia
What Links Here

Comments

  1. Ahh, yes, the almighty “flow”. Fortunately, I’ve found my way around breaking the flow when I don’t know something. Of course, it’s probably not my invention and I look rather silly for being so proud of it, but we tend to do that…

    Anyway, act as if absolutely everything you don’t know can be handled by a function. I don’t care if it actually can, just pretend. Then insert the “function” name in place of the code, no matter how large. It keeps the flow, plus you can look up that sort of stuff after you’ve done the rest.

    Not foolproof, but workable.

    This is not to say that you shouldn’t try to memorize some stuff, but it’s definitely useful.

  2. This is an interesting thing for me – I do live phone tech support; and while I do have to look up certain things, in effect I am always under a time-crunch to solve a problem, and therefore have a BUNCH of things, that I would otherwise look up, memorized.

  3. There are so many things related to my job as a PHP developer that I just don’t bother to remember because the answer is one search away.

    One thing that I’ve found to be true is that when people need to remember something, if it doesn’t come to them immediately and they have a reference at the ready — Google, a cheat sheet, a knowledgeable coworker — they don’t try. Given the same circumstances without the ready reference, they can remember it no problem. The problem isn’t necessarily with the memorization, because in most cases it’s already been memorized. It’s more a matter of making yourself remember it.

    I find this to be true at work a lot; people will run into a snag, and if I’m around they’ll ask me for help. But if I’m not around — or just not within view — and they run into a similar or the same snag, they get through it just fine.

    Would you be more effective if you kept a set of flash cards in your pocket so that when you’re waiting in line at the post office, you could quiz yourself on the array keys for the $_SERVER global?

    I’d love to see that!

  4. Borrowing from a different discipline (songwriting), I end up in much the same place that Sauron did. For example, the original lyric to a certain Paul McCartney composition’s first verse was “Scrambled eggs, oooh baby how I love your legs” – which held the pattern open for him to later fill with the far more memorable “Yesterday, all my troubles seemed so far away.” Plug something in and come back to it if you must – Einstein never remembered a number of things having to do with basic math and couldn’t balance his own checkbook and, when pressed, remarked that he didn’t want to clutter his head up with that stuff. After all, that’s what the reference books on the corner of my desk are for (and anyone saying that they’re really only there to provide a more convenient prop for my coffee cup, while possibly correct, has taken a seat in the rear of the bus) :)

Comments are closed. If you have something you really want to say, email editors@gadgetopia.com and we‘ll get it added for you.