How to Learn How to Program

Here’s a common question I see all the time when scouring my favourite forums: “how can I learn to program?”

20 to 30-odd years ago the answer was “go to school” or “buy a textbook + software and try it out”.  The development ecosystem has obviously changed then.  Developing software has permeated across various industries and the practice as a whole has become very easy to get into.  Almost everybody has access to a computer with the Internet.  Almost everybody can download piles upon piles of free software to use to get started and numerous guides.  With web and mobile applications being exceedingly popular, the tools to get started right at your fingertips, and the news of lucrative salaries and an ever-increasing shortage of quality developers, the idea of becoming a self-taught developer is very tantalizing.  The only real investment required now is your time.

With that being said, there are many resources out there that range from less-than-deal to just plain bad.  Software development bootcamps are terrible.  Sites like Codecademy and W3Schools, while helpful for learning syntax, don’t really teach you how to program.  Instructor-led courses ultimately leave you at the mercy of the course syllabus and the quality of the instructor.

I still believe that a very talented developer can be self-taught provided that they don’t circumvent the process.  Some people just want to learn how to make websites, so they’ll learn some basic HTML markup, some CSS, jQuery without ever actually learning Javascript, and probably use WordPress as their base to minimize the amount of PHP they really need.  I don’t think there’s anything wrong with that.  I think it’s a great gateway.  However, until you go back and fill in the gaps you’ll know how to build web software, but you won’t really know how to program.  This is a classic case of putting the cart before the horse and I see too many developers fall into this trap only to have it backfire on them when they start running into difficult problems.

Perhaps one of the most important things you can do for yourself is to nail down your fundamental programming skills before you focus on building software.

Here’s my list of fundamental skills a “novice” developer needs before (s)he can start building things:

  1. First Language Syntax
  2. Variables and Functions
  3. I/O
  4. Flow Control
  5. Looping
  6. Recursion
  7. Data Structures/Algorithms
  8. Persistence
  9. (Optional) Object Oriented Programming

With these basic tenants down a programmer can theoretically build anything from scratch.  Assume you were developing in a world with NO frameworks, NO libraries, NO protocols, and NO markup languages or stylesheets.  This is everything you would need to get off the ground.  As they say, “to create an apple pie from scratch, you must first invent the universe”. Once you’ve got these fundamentals down, you can go invent the universe… if you want.

If you’re a sane person, you’ll look into things like frameworks, protocols, libraries, and whatever else you need.  If you want to move over to the web, you’re going to need HTML, CSS, Javascript, and likely a server-side language in addition to knowledge of HTTP.  That’s a protocol, a markup language, a stylesheet language, and two new languages (client side Javascript and server side whatever), most of which will require you to apply the same nine concepts above. Suppose you want to build a mobile app.  Chances are you may or may not be learning a new language for the app, and on top of that you’re learning whatever framework the provider offers.  You’ll be using that framework in conjunction with the nine tenants above to build whatever you need.  Want to build a videogame?  Chances are you’re learning a whole bunch of APIs and likely writing in C++, but you’re still applying the same nine tenants above.


Where you go and what you learn next depends largely on the avenue you venture into.  If you’re a freelance web developer building small websites/applications for your clients, you’re going to be entrenched in the client side and spend a lot of time working with service APIs.  If you’re an enterprise web or application developer you’re likely dealing with large databases and large amounts of data.  As you mature you’re going to start learning some less trivial tenants:

  • Optimization
  • Caching
  • Design Patterns
  • Asynchronous programming
  • Multithreading
  • Software Architecture and Design
  • Security
  • Debugging
  • Refactoring

The list goes on and on and on.  To elevate yourself to an intermediate and senior developer, you’re going to have to nail these down too.  For now though, let’s get back on track.

The next question that always comes up is “what language should I learn first?”.  The language you learn isn’t as important as the concepts you learn.  With that being said, there are several good “learner” language options out there, many of which are driven by a particular language’s popularity.  It does make sense — if you want to be an *x* developer, learn the fundamentals in *x* and you’ll be productive much faster because you won’t have to learn another language.

Every starter language is going to have its pros and its cons.  I still like C as a good first-timer language to learn at least your first seven tenants because it teaches you a bit about the nitty-gritty underlying concepts that will help you later on.  If your first language is something like Java or Python you would never know that strings are tricky.  You might learn that strings are immutable but never really understand the significance of that.  You might learn that a variable stores data in memory but you won’t get hands-on experience using pointers/references and working with memory addresses, nor would you understand the significance of the fact that Java passes references to objects by value. You might know that there’s a garbage collector running to free memory, but you won’t understand the beauty (and difficulty) of it until you’ve had to use malloc() yourself.
C does have two problems.  It’s not object-oriented so you’ll never learn those concepts, and it’s rather uncommon to have a C application that connects to a database for persistence.  When you reach this stage in the game, I would move on from C.  Python is a great utility language to learn.  It does a lot of things very well and it’s used across a wide range of programming applications.  Java is a pretty solid language to learn as well thanks to sheer popularity, very good libraries, and near-strict enforcement of OO.  You can, of course, use those languages from the start and skip C altogether, as any thumbs-up I give to C as a learner language is just a result of my own experience.

Once that’s all said and done, you can pat yourself on the back.  Chances are you’ve experienced first hand the joys of getting your first “Hello <name from input>” program running and the sheer frustration of a segfault (had you gone the C route) or at least the trouble of hitting a large bug.  You know how to control the flow of your application, how to delegate repeatable pieces of code to functions, how to iterate across loops, how to recursively solve problems, how to read/write data from a variety of sources (incl. flat files, databases, console), and how to structure code in a logical manner.  You have a taste of what development is all about and you have the skills to build everything.  NOW you can go ahead and pick the stream you want to pursue, be it web, mobile, server side, client side, embedded, game development, or any other stream of programming, and start learning how to build real software of whatever type you choose!