Module Three: Coding to Learn and Learning to Code
What is it Actually Like to Code?
Coding is a bit like trying to have an instructive conversation with a young child who does not speak the same languages as you, and you only have a vague idea of what language she does speak. Unlike the child, however, the computer will not be trying to figure out a way to communicate back with you.
My uncle used to love to tell me that "a computer is nothing more than a fast idiot". Things have changed a lot in the technology landscape since then, but when it comes to the type of coding we'll do in this course, and what most people are likely to learn, this is still resoundingly true.
Computers will do what you instruct them to do, exactly.
Have you ever worked with a child who followed your explicit instructions to the letter, with a result that was inconsistent with what you actually meant? This is not an unusual result when you are writing a computer program. It's not that computers are trying to be maliciously compliant, it's that they do not make any allowances for cognitive leaps or metaphorical speaking, in any sense. If you tell a computer to drive 50mph south, it will drive south at 50mph no matter what obstacles appear in the way, no matter how many stop signs appear, no matter what bodies of water stand between it and due south.
Computers will ONLY do what you instruct them to do.
When you write instructions for a computer, you have to be incredibly meticulous, and cover every single step in a decision-making process to get the results you want. The computer will not infer anything that is not explicitly written, and it won't bridge a gap if you neglect to explain a part of the thinking process.
If you've ever tried to convince a teenager to clean their room, you may understand exactly what I mean here. They may have "cleaned their room", but perhaps the silverware never made it into the dishwasher. They may have "cleaned their room", but their dirty laundry may have been shoved under the bed instead of into the laundry hamper.
To get the result you want out of a computer program, you have to include absolutely everything you want it to do from beginning to end, without leaving anything out.
Computers cannot overlook typos, misplaced parentheses, or other syntactical errors.
To a computer program, "code" and "Code" are two different words because a capital C and a lower case c are not the same character. Similarly, a colon and semicolon are different characters. A computer program will not run if 99.9% of the code is written correctly, because it will get stuck on the place where you left an extra space or didn't indent to the correct degree. The vast majority of problems I've had to fix when writing programs were typos, most of which were absolutely tiny and therefor took forever to find.
Fortunately, modern coding programs (called IDEs, or Integrated Development Environments) make it a lot easier to find the errors in your code!
A lot of trial, and nearly as much error.
Having worked with a lot of programmers over the last decade or so, I can tell you that the trial and error process in coding never really ends, no matter how long you've been doing it. Languages are constantly being updated and expanded, which languages are in popular use is always changing, and since no two pieces of software are the same, the types of problems you'll try to solve with programming will always be new and different.
In the beginning, new coders tend to assume that they're fighting with their code because they're just not good at coding, and you may hear this from students a lot. In reality, though, coding means solving problems in collaboration with a partner that is inflexible and unwilling to meet you half way.
When frustration hits, and it will!, the best option is to take a break and come back later with a clear head to try again.
Here's a video of me fighting with my code, in case you don't believe me.
Video: The Struggle
What is it like to Learn to Code?
Learning to code is a lot like coding itself in that there is likely to be a lot of trial and error in the process of learning and becoming comfortable with coding. Specifically, to learn how to code in a regular coding language, there are two separate parts that need to be mastered,
- The fundamental concepts of coding, some of which are introduced below, and
- The syntax of the language you are learning to write code in.
In the beginning, it can be very difficult to tell which part you are struggling with as you create your first projects. This is part of the reason that block coding platforms (like Scratched) were developed to help new coders! We'll talk about Scratch more in the next section!
For now, I recorded this video to talk more about what you can expect when you're learning to code!
Video: What to Expect When Learning to Code
Some Fundamental Coding Concepts
Block Coding in Scratch
What is Scratch?
Signing up for a Teacher's Account
Tour of a New Scratch Project