One of the beginner difficulties with programming
For some reason I occasionally think about programming pedagogy even though I don't teach anyone and I'm not in any hurry to write a book about it. I do occasionally give advice to beginners or even absolute beginners, though in the latter case it's usually "here are two book options that seem to be successful for that audience, even when or especially if you don't have a clear picture in mind of what you want to learn programming for". (The books are Zed Shaw's Learn Python the Hard Way, and alternatively David Touretzky's Common Lisp: A Gentle Introduction to Symbolic Computation.)Anyway, there are many difficulties in learning to program. Programmers often like to say it's really easy, but if it were so easy, I think it'd be even more popular, and there would be other signs too, like students more frequently getting straight As in classes. The difficulty I want to talk about here isn't in logical thinking though, which may be the hardest part, nor syntax. (Syntax can range from "easy" to "hello APL"; I still remember it taking quite some time for me to get used to PHP's for loop syntax, it was my first language.) No, the difficulty is much more basic and something I think a lot of programmers don't think much about on its own, especially since it shows up all over the world in areas outside of programming: the concept of abstract mapping.
To put it another way: things standing in for other things. One of the simplest examples that comes to me is analog TV channels: I want to watch the Fox channel, say, how do I do that? Well I start going through the channels: channel 1, channel 2, channel 3, ... sometimes channels won't have anything but static on them and will be skipped. Eventually I might see that channel 13 is Fox. So now I associate in my mind that 13 is Fox, and if I want to watch Fox again later, I can remember that I just need to enter 13 on my TV remote and it'll take me to Fox. "13" maps to "Fox"; that is, I have a mental map where the label "13" is interpreted as a TV channel, just like a map of the US States has a label "Alaska" that is interpreted as a geographical region, population, culture, climate, etc.
Contrast this with, say, YouTube, where if I want to watch the Fox channel, I can just type "Fox channel" in the search bar and voila. (Perhaps on YouTube Kids it would show videos or a channel about foxes, which would be an improvement.)
The TV example is probably dated, nevertheless these associations are everywhere still, even if a lot of mass market success comes from reducing friction by removing the need to learn about many. You'll find them as you get into professional areas, because a side benefit of these associations is that they're often faster when learned. It's much faster to enter "13" on a remote than it is to press the catalog button and scroll through some arbitrary list of channels until you find one that says "Fox", or even to type the word "Fox".
Similarly, it's faster to learn that ctrl+c and ctrl+v do copy and paste, vs. having to find those words after using your mouse's right click menu every time. The abstract mapping is a keyboard chord to actions on the computer.
In the world of computer graphics, a good example would be layer masks in Photoshop or some other similar program. A layer mask controls the transparency of another layer. It can start off all white -- fully opaque, the image on the other layer remains completely visible. If you turn the mask all black, then the other layer being masked becomes fully transparent and invisible. And you can turn the mask to any shade of grey in between for different levels of transparency on different parts of the other layer. A common use is to make a smooth gradient that fades from white on one end of the image to black on the other, or to smoothly "mask off" only part of an image so it smoothly fades into another (and non-destructively like using the eraser tool would be). The abstract mapping is white/black/grey to transparency.
Learning any mapping or association itself can be hard to remember and make sticky, especially if the two things are rather unrelated. Why should a number stand for a TV channel? And it's not necessarily even consistent; in another region, the number "9" might be the channel for "Fox". And it's not necessarily even unique, the number "13" might be how you remember Mode 13h, even though it's "13" in hexadecimal, and you only care about that mode for what the mode does.
In programming, there are a lot of "established" associations that you just have to learn and get used to to be effective in a lot of domains. "255" is the color white. So is "FFFFFF". So can be "1". The color white can be opaque. It can also be transparent in some contexts. These are just some of the 70,000 (± 20,000) facts that a software engineer needs to know to be effective.
But it's even more difficult than just learning common associations, you also need to create new ones yourself. You become almost as bad as Humpty Dumpty with "When I use a word, it means just what I choose it to mean -- neither more nor less." Just that we programmers are a little more sane: we don't change the meaning of words themselves, but just rather use them as substitutions for other words in particular contexts in idiosyncratic ways.
The point of an example being to learn the association is such an easy point to skip over in beginner material, too. So many people have complained about "uninspired", to put it nicely, examples in beginner material. Anything with "foo" and "bar" for instance. Or for another example, I might say this is how you define a list of items in Python: items = [1, 2, 3]. Maybe I'll try and "spice it up" by suggesting a "shopping list": shopping_list = ['apple', "celery", "milk", 'salt'] But in either case, the items themselves aren't the important bit, nor is an implied "real world use"; the important bit is the syntax of the equal sign, the square brackets, the quotes for strings, and the commas. Those things all abstractly stand for the concepts of creating a list of whatever, separating the items, and assigning it to some variable. Other languages have different syntax, or no short way of expressing this at all, but you can still create a list in anything. Again, it's rarely stated explicitly that the point of the example isn't what the example is doing (creating a list of items) so much as establishing how to do it in a particular language. To show the abstract mapping of that language's syntax to the action of creating a list, not just showing creation of a list.
A lot of higher level "programming style" debates about "cleanliness" or "taste" or "preferred practices" and "rules of thumb" are related to ways of creating abstract mappings in ways that other programmers (and yourself in the future) won't find too difficult to absorb. Using descriptive variable names is just one such practice. We're not mathematicians, and we are often dealing with well beyond 26 distinct names in a program, so if we insisted on making our variable names single letters for everything that would be an unnecessary hurdle. Why should "o" stand for "shopping_list" when we can just write "shopping_list"? (And you get rules of thumb for exceptions too -- like "i" being fine for "index" or "iterator" in many local loops.) Naming things well involves trying to make our abstract mappings less abstract and more natural as associations.
Posted on 2026-01-06 by Jach
Tags: programming
Permalink: https://www.thejach.com/view/id/452
Trackback URL: https://www.thejach.com/view/2026/1/one_of_the_beginner_difficulties_with_programming
Recent Posts
2026-01-06
2025-12-31
2025-11-10
2025-10-15
2025-08-18