Code is just telling a computer what to do
The goal of any piece of software – as large as Gmail or small as a little calculator – is to get something done. The easiest way to understand code is to try and think through how you’d get that thing done, step by step. If we wanted to build Gmail, or any email client, we’d need to make sure it does a few things:
- Show me my emails
- Let me send and reply to emails
- Let me mark emails as junk or flagged
And if we wanted to dive deeper into one of these – let’s choose Let me send and reply to emails – we could break it down into even more specific tasks:
- A text editor to write emails
- Address fields to put in recipients and cc / bcc
- A little “swoosh” sound when we send an email
We can also break these into even more specific tasks – let’s choose Address fields to put in recipients and cc / bcc:
- A cc field
- A bcc field
- Show cc in sent emails, but don’t show bcc
- Auto-complete email addresses in these fields
You get the point by now. Every “feature” – or thing you want to build – eventually breaks down into “when your user does X, the program does Y.” Code is how you make that happen in practice.
To make this even more concrete, let’s take a look at a little app I built last year called SNQL – it helps you track the sneakers you own and when you wear, trash, or sell them. I…need help.
Here’s what it looks like (I know, it’s not pretty):
When you add in a new pair, it gets stored in a database. So the code needed to build this program was pretty simple: HTML/CSS to build and style the web page, and Python to add the data you’re inputting into the form into a database on the backend. If you click on the Manufacturer Name dropdown, it shows you the available manufacturers; that’s also the work of a Python script.