There are hundreds, if not thousands, of sites that offer tutorials on learning how to write computer programs. Many of these tutorials start out with the classic “Hello, world!” example where the learner is shown how to get the phrase “Hello, world!” to display on the screen, and from there the tutorial moves right into showing the learner how to write code to do arithmetic and then on to if statements and loops and functions. The learner is soon drowning in code writing without perhaps understanding what is going on with the code they are writing.
The first thing a new programming student should be learning is how to read programs and understand what they are doing. One of the best ways to learn code reading skills is to learn to trace the values of variables through a program, which is called variable tracing.
let salary = 2000; let deductions = .25; let net_salary = salary – (salary * deductions); salary = 3000; deductions = .30; net_salary = salary – (salary * deductions);
Here is the variable trace:
salary — 2000
deductions — .25
net_salary — 1500
salary — 3000
deductions — .30
net_salary — 2250
When the learner can successfully update the values of variables as they read through the program, they are mastering the ability to successfully read code.
while, etc.), variable tracing will get harder but will prove more valuable to the learner.
Although we still talk about programming as a standalone career, the dominance of technology in our lives makes it clear that coding is much more than a career path. In my opinion, computer science is more than a college major or a high-paid job; it’s a skill, essential for thriving in a modern-day economy. Whether you work in healthcare, marketing, business, or other fields, you will see more coding and have to deal with a growing number of technologies throughout your entire life.