When learning how to code for the first time, there's a common misconception that learning how to code is primarily about learning the syntax of a programming language. That is, learning how the special symbols, keywords, and characters must be written in the right order for the language to run without errors.
However, focusing only on knowledge of syntax is a bit like practicing to write a novel by only studying grammar and spelling. Grammar and spelling are needed to write a novel, but there are many other layers of skills that are needed in order to write an original, creative novel.
Similarly, to be developer and write original, creative code we need other layers of skills in addition to syntax. Here is one way to organize these skills into what I call the four layers of programming skills:
This is the layer that is most often focused on in the early learning phase. Syntax skills essentially means how to read and write a programming language using the rules for how different characters must be used for the code to actually work.
Being the first layer doesn't mean it's not important! This can be deeply challenging to master and is an essential skill that needs practice to build fluency and apply the other layers.
Programmatic thinking means how to think like a computer and translate a process into a specific set of instructions that a computer can understand. It also means understanding programming concepts like data, variables, functions, objects, etc. This isn't about writing the correct symbols in the right order, it's about how to communicate a specific series of steps to the computer that it's capable of completing.
Humans are capable of both intuitive/visual thinking and logical/verbal thinking. If you were asked to identify the tallest person in a room, you could scan the room visually and quickly pick out the tallest person. Computers can't do that (yet). So, for a computer to do the same thing, we'd need to come up with a more specific and logical process for identifying the tallest person.
Coming up with that logical process is programmatic thinking. In this example, you could ask everyone to write down their name and height, and then you could sort through the thousand slips of paper to put them in order. You could ask everyone to line up, and then compare the height of the first and second person in line. Take whoever is taller from that comparison and compare their height to the third person in line. Whoever is taller in that comparison, compare their height to the fourth person in line, and so on until the end.
To write code, you need to be able to define this type of logical process, and then understand how that translates into the way a computer processes information. The syntax is then simply the standard used to communicate the process to the computer.
If you know the syntax for a programming language and you have programmatic thinking skills, you still might run into difficulties writing code. When you're faced with a programming problem, you still need to answer the question, "how exactly do we get from point A to point B?" Even with a mastery of syntax and concepts, you'll still be faced with a blank page when you sit down to write.
Just like with the tallest person problem, there is typically more than one way to do something, and the more complex the problem is, the more ways there are to solve it. Syntax has one right answer—it either works or it doesn't. Programmatic thinking has many possible answers. There often isn't an answer you can simply copy and drop into your code, and even the problems that do have common solutions with examples you find online may have even better solutions that haven't been created yet.
At some point in the process, in order to write original and unique code, you're going to need creative skills. There's a myth that creativity is something you're born with and that it can't be taught, practiced, or learned. The truth is that creativity is a skill just like any other skill, and it can be practiced and improved. Creative skills include things like:
- Rough drafting/sketching code
- Taking breaks
These creative skills are necessary to figure out an answer when it's not obvious what it should be—to navigate going from a rough draft to a final draft with all the bumps and detours in between.
The best thing about these skills is that they don't just apply to programming—they can apply to anything you're doing from cooking to writing to playing a sport, and if you have other areas where you practice creativity, that can help you apply more creative skills to programming.
Writing code is never just about writing code—writing code is always connected to something else. Maybe you're making a website about tea, or a fitness app, or a website for a local car maintenance shop—code always exists in a way that's connected to other topics, not in a vacuum by itself. Having skills and knowledge in lots of other areas besides programming not only helps you make projects related to those areas in a more thoughtful way, skills borrowed from other fields can influence the way you write code and help you come up with solutions you wouldn't have considered otherwise. Balancing programming with curiosity and exploration of other topics makes programming even better!
As learners and teachers, it's important to identify all of the skills we need to learn in order to be a developer. Different students find different layers easier or more challenging than others. Many people who have no problem remembering syntax struggle with programmatic thinking. Many people who have no problem with programmatic thinking have a very difficult time remembering syntax. As learners, recognizing this makes it easier to get unstuck when things are difficult because we can identify the area that is most challenging at the moment. As teachers, when we recognize the whole spectrum of skills that need to be developed, we can make sure we create exercises that cover the entire range.
Thoughts, questions, comments? Let me know what you think on Twitter or in the comments below!
This post was originally published on my personal site.
It's midnight. You're huddled in the restricted section of the library, eyes glued to powerful tomes—Creating Killer Websites! Resilient Web Design! The Pragmatic Programmer! You get a missive from your co-conspirators in the Late Night Code Club—another night of adventurous learning is about to begin.
If you enjoyed this post and want to read more like it, I'd like to invite you to join the Late Night Code Club by signing up for the newsletter—it's a programming education newsletter all about learning and teaching programming. We're exploring new approaches to learning and teaching, code as a creative practice, and programming as part of an interdisciplinary education. In each newsletter you'll receive updates about new posts as well as other resources and ideas all about learning programming! It'll be short, interesting, and encouraging for learners and teachers. See you there!