Learning Programming From the Ground Up
How do you learn programming, if you don’t know anything about programming at all? I’ve been very curious about this problem, especially in recent months, as I hear stories of the digital divide, and the growing gap between STEM graduates and jobs in the US. There is also the question of digital equity – if someone has already gone past school and college without exposure to the basics of programming, what are their options for catching up?
I spent about six years and change studying for two degrees in Computer Science. I learned how to program before I joined college. But a lot has changed since I went to college, and while it might have been expensive and difficult to introduce oneself to these concepts back then, today there are a host of services and tools that make it much easier and faster to come up to speed on how programming works.
This blog post is the first in a series that focus on these services and tools, to teach someone who isn’t a programmer, to learn how to teach themselves the skills. These posts will assume not that you are a programmer, but that you’re willing to follow the exercises, search for answers on the Internet, and be creative in attempting to find the answers.
Even if you haven’t done what you might think of as programming, you probably have had some exposure to computers. In a sense, all interaction with computers is “programming” – you are telling the computer, or a specific program on the computer what to do, and the computer responds per a set of instructions. All programming is the process of writing a set of instructions that take inputs and use them to decide on what output to produce.
Most of the applications we use on a computer – browsing, playing games, even sending emails – hide a very complex set of instructions behind very simple interfaces. It’s hard to see oneself as “programming” in these interfaces, because these interfaces don’t let you change the ways in which the inputs are manipulated. There’s only one way to send an email – click the “Send” button, usually – and you can’t create a button of your own that says “Send tomorrow.”
There is, however, one application that’s fairly common, and that does let you experiment with changing its behavior – spreadsheets. You could use Microsoft Excel or Google Spreadsheets – the former has richer functionality, but for the purposes of learning how to program, the latter is a fine place to start.
Spreadsheets allow you to write instructions on how to manipulate the data in the spreadsheet. These instructions are essentially “programs” or “code,” and they help you learn many of the concepts you are going to use when programming much more complex applications.
There are two key programming concepts that a spreadsheet helps you understand:
- Taking data inputs, by using variables
- Displaying outputs by calling a function
Let’s perform a simple computation – addition: Suppose we start with a spreadsheet with two values:
To add these two numbers, let’s write the following into a third cell: =sum(A1, B1)
Your spreadsheet will now look like this (assuming that you wrote the above formula into the third column of the first row:
7 15 22
The simple formula is our first program, and it helps illustrate some ideas that you will use in pretty much every program you use:
- Outputs, or return values
Let’s look at these one by one, starting with functions in our next post.