programming is terriblelessons learned from a life wasted

What language should I learn first?

Despite my best efforts to warn people about programming, i’m often asked to suggest a good language to start with. I normally suggest a relatively useful language from the outset, and by that I mean something–

So which language is that then?

This usually whittles the contenders down to popular scripting languages—Python, Ruby, JavaScript, Lua or similar. A little more structured than Bash and a lot less effort than a compiled language. To me, the project attempted rather than the language used, is the more important choice. Learning a language should be a side effect of some larger and more interesting goal—It is hard to learn languages for their own merits, without having something to build.

To begin with, think about what you want to create rather than the toolset. Don’t worry about objects and classes too much. Start with logic and flow—if, while, for, and functions—and then worry about data structures and algorithms. Get simple functions working to make fun or useful things happen.

Scripting? Real programmers use C! I want to be a Real programmer!

C is a useful language. Many languages are implemented it it, and many libraries and operating systems are too. Nonetheless, unless C is the only option, I wouldn’t advocate it as a first language—because it is hard to do anything immediately useful with it, in a small amount of time. Advocates argue that “C is character building”. Great job! Suffering is such a fun learning experience!

Even in the grizzly macho world of unix, people learn shell before they learn C. Using C effectively requires much more knowledge of the operating system, as well as data structures. .

I hear Java and C# are also popular in industry, should I learn those first instead? I want to get a Job!

Using C# and Java are difficult for vastly different reasons to C—I’ve been in a class where people were made to chant "public static void main". Using Java and C# well requires a good understanding of objects and classes first, and without it many sprinkle static over their code to make it compile. C# and Java are designed for larger programs, not beginner programs—the learning curve is steep for the basics of procedural programming.

For those languages, a simpler scripting language is available on the runtime, with access to the same libraries. You don’t need to worry about writing larger programs until you’ve written a few small ones first. Java, C# and other heavyweight platforms make better second languages—Where you can invest the time learning the API, rather than fighting an unsympathetic environment

What about mathematics - how much needs to be learned?

Well, I’d say maths and programming are actually quite related, but you need to understand as much mathematics as your program demands—which varies wildly. Not many programs have a high demand of math skills beyond counting. If you can use a spreadsheet, you probably know more than enough to start churning out scripts.

Part of programming is mathematical, not to say that differential geometry is somehow going to be useful, but reasoning about your program requires the same discipline of thought found in mathematics. I’m not saying that programers need to be mathematicians, but programmers /are/ mathematicians. Proofs are programs, innit.

So programs are mathematical but I shouldn’t learn a functional language?

Simply: functional languages aren’t as popular as scripting language. Unless you have a friend who is enthusiastic about them, it can be harder to dive in—often less documentation, a smaller community and less third party libraries. They do make excellent second, third and fourth languages though—You’ll find out the features the mainstream languages will absorb next.

One obvious exception—If you’re going into a computer science course, they make an excellent start. It can be a bit longer before you have something and useful, but Racket and Haskell can be fun too.

What’s the easy way out?

The first programming language you learn will likely be the hardest to learn. Picking something small and fun makes this less of a challenge and more of an adventure. It doesn’t really matter where you start as long as you keep going—keep writing code, keep reading code. Don’t forget to test it either. Once you have one language you’re happy with, picking up a new language is less of a feat, and you’ll pick up new skills on the way.

Coding requires interdisciplinary set of skills—to be able to write fluently, have critical reasoning skills, and exercise engineering dicipline as well as mathematical reasoning. Often overlooked is one of the most vital skills—Domain experience of the problem you are trying to solve.

Programming isn’t just explaining things to the computer but a medium for design, engineering, science, art and play.