How My Two-Year-Old Twins Made Me a Better Programmer
TL;DR version: “information != knowledge; knowledge != wisdom; wisdom != experience;”
I have two-year-old twins. Every day I watch them figure out more about the world around them. Whether that’s how to climb a little higher, how to put on a t-shirt, where to put something when you’re done with it, or what to do with these crazy strings hanging off your shoes.
It can be incredibly frustrating to watch them struggle with something new and fail. They’re your children so your instinct is to step in and help. But if you step in and do everything for them they never figure out how to do any of it on their own. I’ve learned to wait until they ask for help.
Watching them struggle and learn has made me realize that I don’t let myself struggle enough and my skills are stagnating because of it. I’m happy to let Google step in and solve all my problems for me. I get work done, true, but at the expense of learning new things.
I’ve started to think of this as the Stack Overflow problem, not because I actually blame Stack Overflow — it’s a great resource, the problem is mine — but because it’s emblematic of a problem. I use StackOverflow, and Google more generally, as a crutch, as a way to quickly solve problems with some bit of information rather than digging deeper and turning information into actual knowledge.
On one hand quick solutions can be a great thing. Searching the web lets me solve my problem and move on to the next (potentially more interesting) one.
On the other hand, information (the solution to the problem at hand) is not as useful as knowledge. Snippets of code and other tiny bits of information are not going to land you job, nor will they help you when you want to write a tutorial or a book about something. This sort of “let’s just solve the problem” approach begins and ends in the task at hand. The information you get out of that is useful for the task you’re doing, but knowledge is much larger than that. And I don’t know about you, but I want to be more than something that’s useful for finishing tasks.
Information is useless to me if it isn’t synthesized into personal knowledge somehow. And, for me at least, that information only becomes knowledge when I stop, back up and try to understand the why rather than than just the how. Good answers on Stack Overflow explain the why, but more often than not this doesn’t happen.
For example, today I wanted a simple way to get python’s os.listdir
to ignore directories. I knew that I could loop through all the returned elements and test if they were directories, but I thought perhaps there was a more elegant way to doing that (short answer, not really). The details of my problem aren’t the point though, the point is that the question had barely formed in my mind and I noticed my fingers already headed for command tab, ready to jump the browser and cut and paste some solution from Stack Overflow.
This time though I stopped myself before I pulled up my browser. I thought about my daughters in the next room. I knew that I would likely have the answer to my question in 10 seconds and also knew I would forget it and move on in 20. I was about to let easy answers step in and solve my problem for me. I was about to avoid learning something new. Sometimes that’s fine, but do it too much and I’m worried I might be more of a successful cut-and-paster than struggling programmer.
Sometimes it’s good to take a few minutes to read the actual docs, pull up the man pages, type :help
or whatever and learn. It’s going to take a few extra minutes. You might even take an unexpected detour from the task at hand. That might mean you learn something you didn’t expect to learn. Yes, it might mean you lose a few minutes of “work” to learn. It might even mean that you fail. Sometimes the docs don’t help. The sure, Google. The important part of learning is to struggle, to apply your energy to the problem rather than finding to solution.
Sometimes you need to struggle with your shoelaces for hours, otherwise you’ll never figure out how to tie them.
In my specific case I decided to permanently reduce my dependency on Stack Overflow and Google. Instead of flipping to the browser I fired up the Python interpreter and typed help(os.listdir)
. Did you know the Python interpreter has a built-in help function called, appropriately enough, help()
? The help()
function takes either an object or a keyword (the latter needs to be in quotes like “keyword”). If you’re having trouble I wrote a quick guide to making Python’s built-in help()
function work.
Now, I could have learned what I wanted to know in 2 seconds using Google. Instead it took me 20 minutes1 to figure out. But now I understand how to do what I wanted to do and, more importantly, I understand why it will work. I have a new piece of knowledge and next time I encounter the same situation I can draw on my knowledge rather than turning to Google again. It’s not exactly wisdom or experience yet, but it’s getting closer. And when you’re done solving all the little problems of day-to-day coding that’s really the point — improving your skill, learning and getting better at what you do every day.
-
Most of that time was spent figuring out where OS X stores Python docs, which I won’t have to do again. Note to self, I gotta switch back to Linux. ↩
Thoughts?
Please leave a reply:
All comments are moderated, so you won’t see it right away. And please remember Kurt Vonnegut's rule: “god damn it, you’ve got to be kind.” You can use Markdown or HTML to format your comments. The allowed tags are
<b>, <i>, <em>, <strong>, <a>
. To create a new paragraph hit return twice.