Programmer 101: Teach Yourself How To Code

Programmer 101: Teach Yourself How To Code

You’ve always wanted to learn how to build software yourself — or just whip up an occasional script — but never knew where to start. Luckily, the web is full of free resources that can turn you into a programmer in no time.

Since the invention of the internet, programmers have been using it to discuss software development techniques, publish tutorials, and share code samples for others to learn from and use online. If you’re curious about how to become a programmer, you can get off to a running start using tons of great free web-based tutorials and resources.

First Things First: Don’t Get Hung Up on Choosing a Language

There are several different kinds of software development you can do for various platforms, from the web to your desktop to your smartphone to a command line. In this article, we’ll outline some of our favourite starter tutorials and resources for teaching yourself how to program for each major platform. We’re going to assume you’re a savvy user, but a newb when it comes to wrangling code snippets, so we’ll keep things at the beginner level. Even just following through a beginner programming tutorial, you’ll be happy to see how far you can get.

Desktop Scripting

The easiest way to try your hand at programming for your Windows or Mac desktop is to start with a scripting or macro program like AutoHotkey (for Windows) or Automator (for Mac). Right now hardcore coders throughout the Lifehacker readership are yelling at their monitors, saying that AHK or AppleScript are not “real” programming. That may be true — technically these types of tools just do high-level scripting. But for those new to programming who just want to get their feet wet automating actions on their desktop, these free tools are a fantastic way to start — and you’d be surprised at how much you can do with them.

how to turn any action into a keyboard shortcut using AutoHotkeythe source code for Texter

Web Development

Instead of being bound to specific programming languages and the look and feel of a particular operating system, you can put your killer application in the browser and run it in the cloud, as a webapp. Welcome to the wonderful world of web development.

HTML and CSS: The first thing you need to know to build any website is HTML (the page markup that makes up web pages) and CSS (the style information that makes that markup look pretty). HTML and CSS are not true programming languages — they’re just page structure and style information. However, you should be able to author simple HTML and CSS by hand before you begin building web applications, because a web page is the front-end to every web app. This HTML tutorial is a good place to start.

JavaScript: Now that you can lay out a static web page with HTML and CSS, things get fun — because it’s time to learn JavaScript. JavaScript is the programming language of the web browser, the magic that makes dynamic in-page effects go. JavaScript is also the stuff of bookmarklets, Greasemonkey user scripts and Ajax, so it’s the key to making all sorts of web goodies. Start learning JavaScript here.

WebmonkeyPHP Tutorial for BeginnersWebMonkey’s PHP and MySQL tutorial
strlen function

Web frameworks:Ruby on RailsMixTape.mehis take on how to build a web site from scratch with no experienceCakePHPDjangojQuery

Web APIs: An API (application programming interface) is a programmatic way for different pieces of software to talk to one another. For example, if you want to put a dynamic map on your web site, you want to use a Google Map instead of building your own custom map. The Google Maps API makes it easy to programmatically include a map in a page with JavaScript. Almost every modern web service you know and love has an API that lets you include data and widgets from it in your application, like Twitter, Facebook, Google Docs, Google Maps and the list goes on. Integrating other web apps into your web application via APIs is the final frontier of rich web development. Every good, major web service API offers thorough documentation and sort of quick-start guide to try it out (here’s Twitter’s, for example). Go crazy.

Command Line Scripting

If you want to write a program that takes textual or file input and outputs something useful, the command line is the right place to do it. While the command line isn’t as sexy or good-looking as a web app or desktop app, for rapid development of quick scripts that automate processes, you can’t beat it.

Several scripting languages that also work on a Linux-based web server also work at the command line, like Perl, Python and PHP — so learning one of those baddies makes you conversant on two platforms. My path never took me too far down the Perl road, but I taught myself Python using the excellent and free book, Dive into Python.

If becoming a Unix ninja is one of your programmer goals, you absolutely must get good at shell scripting with bash. Bash is the command-line scripting language of a *nix environment, and it can do everything from help you set up automated backups of your database and files to building out a full-fledged application with user interaction. Without any experience writing bash scripts beyond a dozen lines, I wound up developing a full-on personal to-do list manager in bash: Todo.txt CLI.


Nowadays, modern web apps and browsers are extensible with with bits of software that bolt onto them and add features. Add-on development is gaining in popularity as more developers look at existing software — like Firefox or WordPress — and think “But if only it could do THIS…”

You can do a whole lot in any web browser with just a mastery of HTML, JavaScript and CSS. Bookmarklets, Greasemonkey user scripts and Stylish user styles are created with the same bits of code that make regular web pages, so they’re worth learning even if you just want to tweak an existing site with a small snippet of code.

More advanced browser add-ons — like Firefox extensions — let you do more. Developing Firefox extensions, for example, requires that you’re conversant in JavaScript and XML (markup that’s similar to HTML, but way more strict in format).

Many free and well-loved web applications — like WordPress and MediaWiki — offer an extension framework as well. Both of those apps are written in PHP, so comfort with PHP is a prerequisite for getting started. Here’s how to write a plugin for WordPress. Developers who want to ride the cutting edge of Google Wave can get started writing gadgets and bots in HTML, JavaScript, Java and Python. I wrote my first Wave bot following this quick-start tutorial in one afternoon.

Web Development for the Desktop

The best part about getting started programming in one context is when you can take those skills and apply them elsewhere. Learning web development first is a great way to start because now there are ways to put those skills to work on desktop applications, too. For example, Adobe AIR is a cross-platform run-time environment that lets you build your app once and release it to run on the desktop of every operating system AIR runs on. AIR apps are written in HTML, Flash or Flex, so it lets you apply your web-development skills in a desktop context. AIR is a great option for deploying desktop apps like one of our top 10 apps worth installing Adobe AIR for.

Mobile App Development

Mobile applications like the ones you run on iPhone or Android smartphones are all the rage right now, so you may have dreams of striking it rich in the iTunes App Store with the next killer app. But for the new coder, diving headfirst into mobile development can be a rough learning curve, since they require comfort with advanced programming languages like Java and Objective C. However, it’s worth checking out what iPhone and Android development looks like. Check out this simple iPhone application development example to get a taste of what iPhone developers do. Android apps are written in Java, and here’s a friendly video tutorial of what building a “Hello Android” application workflow looks like.

Patience, Elbow Grease, Trial and Error

Good coders are a special breed of persistent problem-solvers who are addicted to the small victories along a long path of trial and error. Learning how to program can be a frustrating and solitary experience. If you can, get a buddy to work with you along the way. Getting really good at programming, like anything else, is a matter of sticking with it, trying things out and getting experience as you go.

This article is just one self-taught programmer’s top-of-mind recommendations for beginners. Experienced programmers: What did I miss? No matter your skill level, add your thoughts and recommendations for beginners to the comments here.

Gina Trapani, Lifehacker’s founding editor, thinks the best programmers are self-taught. Her Smarterware feature appears every week on Lifehacker.


  • Since high school ive self taught myself PHP, HTML, CSS, Javascript, and AJAX scrpting, and now have a job 🙂

    Ive wanted to jump into C#, but Microsoft’s dreamspark is only open to universities…. Dam freeloading uni bums… 😛

    A job really has helped me learn better, because i could make whatever i wanted when i was at home, but I found it nice to have someone else give me direction, and i play the problem solver. 🙂

  • When choosing a language, once you pick one, stick with it.
    If you change languages too soon, you’ll get confused with the little differences and you will eventually forget all the control constructs, etc, you learned at the start.

    The tipping point for changing languages in my opinion is when you can safely sit down and write out a bit of code that includes taking advantage of some feature of the language (such as inheritance) without looking at the documentation.

    When you do change languages, don’t immediately try to understand every line of a piece of example code. Instead, try to compare the expected results to how you would write it in your previous language. Then, go through the comments (if it doesn’t have good comments, it’s not a good example). Finally, once you understand it, get into the documentation to find out what each bit does.

    This brings me onto Commenting Your Code.
    Do it. Do it often. Do it all the time!
    My rule of thumb is to comment the code as if I’m about to give it to someone else to maintain who is not as strong coder as I am (so basically in ‘tutorial’ style). Alot of people suggest that commenting as if you wont look at the code again for 6 months is good. I disagree on the grounds that I tend to over-estimate my memory, and always end up under-commenting the code.

    If you can, get used to a documentable style of commenting early (such as javadoc, or any styles that doxygen supports) – this gives you the ability to create documentation of your code through just your comments. Makes maintenance and future development ALOT easier.

  • I don’t really hold with saying Java and Objective C are “advanced” languages compared with HTML/CSS/Javascript/AJAX.

    The course of web development is about 50% coding, 50% trying to get it to work cross-browser.

    Java is great as it works on pretty much any platform (like Adobe AIR). It also has a simple(r) way of looking at Object Oriented Programming than a language such as C++ or PHP.

    Note, however, I currently work with HTML/CSS/Javascript/AJAX/PHP on a daily basis, but that is after 4 years of learning (which is after about 6 years of learning languages like C and C++).

  • Well let me say “Real programmers don’t write comments”
    Comments are on face of it good but they have to be current. Another person comes along and changes code as it is not what was wanted. Doesn’t change the comment and we have an impasse.
    Always look at the code to see what it does not the comment.

    The language doesn’t matter – web coding is now what is in fashion.

    • What you have there is a bad coder, not bad comments.

      If the second coder isn’t keeping up the comments, then they shouldn’t be making changes (or be employed, etc).

      Having said that, I do agree that you must always check the code – just because a comment says one thing doesn’t mean the code is identically the same – bugs creep in, and so do the occasional undocumented changes.

      • My applications team uses the following for our comments. JessT – Nice post by the way.

        ‘ Purpose: the purpose of the procedure

        ‘ Ver. Date Author Details
        ‘ 1.00 01 JAN 2008 Your Name Initial version.
        ‘ 1.01 13 NOV 2009 Next Name changed something

Log in to comment on this story!