I was asked recently whether I thought I was a good programmer. I responded, it depends on what you mean by a programmer. I talked to some folks who told me "programming is easy". Somehow, I think their definition of what programming means is different from mine.
In particular, I think they thought programming was knowing loops, arrays, pointers, and functions. Except for a few really gnarly bits, those parts are pretty easy (though you can find people who find those concepts, especially pointers, very confusing, so if it weren't easy, they wouldn't even be in the conversation).
But suppose they were told, this program runs slowly, find out why. Is that programming? They might argue, no it's not, because it's not about writing code. It's about something wrong in a nebulous situation.
Or how about this code doesn't compile? Is that programming? Programs might not compile due to a syntax error. Or a missing library. Or something much weirder. But they might argue "I didn't write the code!". You might retort "but programming is easy, so can't you read what this person tried to do?".
In fact, if you learn programming, you often don't hit these "non-programming" issues. Oh occasionally, you do, but you might say "it's not programming" and expect someone else to figure it out for you. Most people would say you aren't much of a programmer.
Programming, in its purest form, is basically about computation and memory. You have a bunch of variables. You have ways to compute, compare, move the data around.
But reality is different. In particular, most programs require inputs. That might be from a user typing in something. Or it might be from a file. Or it might be a file from some URL. The file might be a video file and you need to decode it plenty fast or it jitters or drops frames.
The input might come from a GUI button. But something goes wrong. Are you willing to read the nasty source code that makes up the GUI to understand what's going on? Or do you say "Why can't these people get their code written right?".
Even if you think programming is about syntax, most languages have some implementation that doesn't work the way you think it does. You assume one thing, but that assumption is wrong (like a compare function returns -1, 0, 1 instead of negative, 0, positive) or you think a compare function returns a boolean. Or you use OR when you meant AND.
Look at C++ templates, and things can get really hairy. It can be difficult to comprehend why a C++ string is a parameterized type taking three (count them!) parameters. Here was a case where someone wanted strings to be both containers and strings. While this has some advantages in unusual situations, it makes the common case a pain in the neck.
And tracing code that uses dynamic dispatch? A pain. And threaded programs? Evil. And tracking memory leaks? Horrors.
All these are beyond the simple assignment statement, the simple conditional, the simple function.
The universe, don't you know, is made up of atoms. And yet, these atoms can behave in an incredibly complex way. For example, all of life. Or skip that. What about stars? Or black holes? Or dark matter? Or how clouds form? Physicists try to come up with theories on how stars behave. All from a bunch of atoms.
Programming might consist of simple stuff, but people can put them together in incredibly complex ways, and because millions of little operations can run in a second, it can be really difficult to determine what's going on. How do you know what the code is doing? In theory, you can follow each and every step, but like tracking hundreds of kids in a school, it becomes an exercise in futility.
Next time someone tells you programming is easy, you probably are talking to someone that's not very good at programming, and doesn't even know it.
Or they're working with a much different definition.
Or they're a genius.
But probably not.
Three recent talks
-
Since I’ve slowed down with interesting blogging, I thought I’d do some
lazy self-promotion and share the slides for three recent talks. The first
(hosted ...
4 months ago
No comments:
Post a Comment