This is the second part of a series of articles called Learn to Code. Click here to go to Chapter 0, “Wax on, Wax off”.
Learn to Code
Well done. You’re now a World class programmer! And you’ve been given a brief by your customer who wants you to write some software for them. The following sentence is the first line of their brief to you:
“Bob is a man. He is 30 years old. He can run 5 miles.”
What a peculiar start!! But bear with me. Remember, in order to start programming, we have to fully understand the real-world thing we are transforming into some computer code. Let’s take that sentence apart and write some bullet points about what we know about Bob:
- Bob is a “something”. A real thing. A proper object.
- That thing is categorised as a “man” (whatever that is).
- Bob has something called an “age”. The value of his “age” thing is “30”.
- Bob can perform an action known as “running”.
- Bob can do that action for “5 miles”.
Sorry for all the quotation marks and playing-dumb, but all will become clear as we move through this lesson.
Like pretty much anything in the universe, Bob can be defined by a set of “properties” (like his age, height, inside leg measurement) and the actions that he can perform (like “run”). In proper programming, we call these “properties”, “properties” (hahaha, surprise! I slipped a programming term into your vocabulary!). Slightly more complex, we call the actions he is capable of performing, “methods” or “functions”, depending on which programming “language” you’re using. We’ll use the term “functions” to start with because the first programming language you’ll use demands this terminology.
The programming language we’ll start with also prefers things to start with a lowercase letter. For now, just accept that, we’ll cover why later. Let’s start by creating Bob in code. Continue Reading “Learn to Code: Chapter 1 – Meet Bob”