What's the best first language for a programmer?

For young developers learning programming for the first time, curiosity and enthusiasm are more important than rigor and discipline

The other day, my friend Ned's cousin asked Ned what he thought was the best first language for new programmers. The cousin didn't have much computing experience, but at 15 years old the future was looming fast, and he thought programming seemed interesting and that it might be something he could get into.

"So naturally," Ned explained, "I told him to learn Scheme."

[ What's your take on the best first programming language? Join our discussion. | Also on InfoWorld: "My kid could code that." | Cut straight to the key news for technology development and IT management with our once-a-day summary of the top tech news. Subscribe to the InfoWorld Daily newsletter. ]

Huh?! Scheme? When Ned first opened up the can o' worms of "which programming language is the best," it seemed like a fine opportunity for an argument, Monty Python style. He'd say Perl, someone else would say C++, a third would counter with Visual Basic, and from there we'd move right on to throwing rolls and upending furniture. But Scheme? This was a bait-and-switch I hadn't expected.

Scheme: The Latin of programming?
Mind you, Ned isn't alone. Lots of prominent universities include Scheme in their first-year computer science curriculum. Many require it. In fact, I'd venture that if you learned nothing but C++ or Java in your college coursework, you probably went to a bad school; if you learned Scheme, chances are you went to a good one.

Scheme is a dialect of Lisp, one of the oldest programming languages still in use. It offers minimal syntax and very few operators. Equally important, Scheme supports the functional programming paradigm, which means it treats programs as the expression of mathematical functions. Any computing problem can be expressed using a unique mathematical notation called the lambda calculus; in a sense, Scheme is merely a parser for programs expressed in lambda calculus.

For the student, this means Scheme lets you focus on the algorithm being implemented, rather than the syntax of the language itself. Mainstream languages such as Java and C++ have extremely complex syntaxes, which are often the result of new features being bolted on as the languages evolve. They force you to learn lots of different control structures and different ways of doing things for each problem you approach. Not so with Scheme, which offers the same terse, predictable syntax for every computing problem. "It feels to me like a much more natural way of instructing a computer than other languages I've used," Ned says.

Still, Scheme? I just couldn't see it. Simplicity and sound computer science are all well and good, but when I was 15, I wasn't really interested in the logic and mathematics that formed the basis of computation. I was fascinated simply by all the different things I could get a computer to do -- and I'm sorry to say, "executing algorithms derived from lambda calculus" wasn't high on that list. Video games? Yes. Lambda calculus? Not so much.

Of course, you can do a lot more with Scheme than just run academic exercises. Today it's a full-fledged language available on just about every platform.

But my biggest beef with Scheme remains that it's essentially a write-only language. One program looks pretty much like another. Its syntax may be simple, but as a side effect, you really have to bore down into the source code of a Scheme program just to figure out what it's trying to do. That makes Scheme an excellent language for teaching programming, but a lousy one for a 15-year-old trying to figure out how to make a computer do stuff on his own.

The realities of software engineering (or lack thereof)
Good, some will say. What we need are fewer hackers and more trained software engineers. Learning programming by diving into the Windows SDK to produce fancy GUIs only leads to bad habits. A programmer who doesn't understand the fundamentals of the discipline of programming can only be a bad programmer -- I've said as much myself.

But what about this concept of "software engineering"? Does it really hold water? Maybe not, says Tom De Marco, principal of the Atlantic Systems Guild. "Software development is inherently different from a natural science such as physics, and its metrics are accordingly much less precise in capturing the things they set out to describe," De Marco writes in the current issue of the journal IEEE Software. "Software development is and always will be somewhat experimental. The actual software construction isn't necessarily experimental, but its conception is."

In other words, no matter how well versed in best practices a programmer might be, programming is as much art as science. Inventing effective software solutions takes insight, inspiration, deduction, and often a sprinkling of luck. Sure, there are good programmers and bad programmers -- but to pretend that you can "engineer" a software project the same way a civil engineer designs a bridge is simply folly. As Jeff Atwood puts it, "what we do is craftsmanship, not engineering."

So give the 15-year-old a break, I say. Scheme may be the "best" way to learn programming, but that can wait for college. At such a young age, I think it's far more important to encourage the student to develop the innate curiosity and love of programming that lies at the heart of any really brilliant programmer. If that means coding in Visual Basic, so be it. Scheme can come later.

(Mind you, the very best way to encourage young students to become programmers might be to stop shipping software development jobs overseas -- but that's a whole 'nother kettle of fish.)

p.s. For the record, my suggestion for the best first programming language was Python. Let the rolls fly!

Recommended
Join the discussion
Be the first to comment on this article. Our Commenting Policies