How to learn how to program

20130324-012425.jpg

First of all: don’t be scared! You can’t break a computer by trying to program it. Oh sure, it’s possible to break a computer…but not for YOU as a beginner. And who cares anyway? The computer was made to serve you, somebody plunked down good money for it to do so, and if it isn’t serving you right, then it’s already broken. Programming should always be seen as a way forward, and any frustrations or missteps along the way merely part of the journey. You will break programs, and then you will fix them, better than before.

Programming is like writing: you need to have an idea and an intended audience before you can get started in earnest. This will help identify the platform and the language you will be writing in. There is no such thing as a “best language” — every computer language is a set of trade-offs distinct from other languages with different trade-offs — but there are better platforms and languages for specific tasks.

What’s a platform? Well, that’s the environment in which your program is going to run. It’s usually a program itself, such as an operating system, a device, a server, a virtual machine or a web browser. Programs written for one platform might not be portable to another and each has its own input and output restrictions, so it’s a pretty important choice. An easy way to start might be to write a program that lives in a web browser, or one that is interpreted by your computer’s operating system on the command line.

Which language should you learn? Well, it doesn’t matter all that much – all languages are very similar if you don’t know anything, and if you do any programming of real merit you’ll probably learn a dozen or more in your lifetime. A journeyman programmer should be able to pick up a new language and be productive in it in a couple of days, though mastery takes years. But you’re going to want to pick a language that works with your target platform, one that a lot of people know about, and preferably one whose platforms and tools don’t cost much. There are toy languages, like Logo, and academic languages like Eiffel. They’re fine for learning specific techniques, but there is no reason not to get started immediately in a language like JavaScript (for the browser), Powershell or perl (for the command line) or Java (for lots of things). These are low barrier to entry languages with free platforms and lots of great free tools and you can get seriously paid working with them.

What about academics? Well, math is pretty important, specifically algebra. Most computer languages owe their lineage to algebraic equations, and you will be building lots of them. Higher math, like trigonometry or calculus, is exceedingly important for some very rare programming tasks but for basic programming, algebra is it. I wrote my first program in second or third grade, so if you’re at least as smart as a sixth grader you’ll do fine. English is fairly important, as many programming languages use English commands in their grammar and many programmers use English in their variable names.

Some understanding of how computers function at a physical level can help you understand what’s going on, but you could get this from a book, like How the Internet Works. At the most basic level, though, you’ll need to know the following things about computers:

  • What a file is and how to manage files using your operating system.
  • How to open programs, use their menus and switch between them
  • How to copy and paste and other editorial functions.
  • How to undo mistakes

To get you moving in your language of choice, you’re going to want a guide. For the languages above there are excellent online resources, so you can just start Googling or Binging until you find one you like. You can also pay to be taught the language, either at a school or at a technical training company like New Horizons. Your best bet, however, would be to buy or borrow a book. Try to get a thin one that makes sense to you — no two readers are the same and that’s why there are so many tech books on the same subject. The Head First series from O’Reilley press are great examples of books that are like nothing else, attempting to teach the same subject using multiple techniques at the same time. Personally I find them insane.

So. Armed with courage, a platform and language choice, a guide, some basic academic skills and an idea, you’re ready to start learning programming. Here’s how you do it:

Program!

Write the examples from the book, then change them to do something else. Notice how each change to the program or to the input changes the output. Notice how the system complains or fails when you do something wrong. Figure out how to fix it — now you’re debugging! See something you don’t understand, a message or a command? Google it. Ask a friend. See if you can change the program around to make a different message. Try removing the command, see if thins don’t get worse!

Install some tools to help you program better. Read more books. Look at other languages and translate your knowledge. Learn some task specific languages like SQL or R. Read some blogs. Read Code Complete, the Pragmatic Programmer, Clean Code, Effective Java. Become a software developer, a software engineer, a software craftsman, a software designer, a software architect, a software artist. Read more books! Go to a “No Fluff Just Stuff” convention. Go to a user’s group.

Programming is easy! Learning to program is easy! And pretty much everybody can do it.

Software, on the other hand, is hard.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s