Learning to Code

I learnt to program computers when I was about 5 years old, on my dad's TRS-80 Pocket Computer, with its single line LCD display and 1Kb of RAM. For better and for worse, I was largely self-taught.

To cut to the chase, when asked how to learn to code, I tend to stress four elements, each beginning with the letter 'M', "the four Ms":





the Motivation

For some people, simple curiosity is enough; but even really curious people who are driven to experiment with the machine, there's always Something they're trying to build: a game, a sprite editor, data storage and data processing for things going on in the rest of your life, and so on. Most of the programs I wrote as a child were basically useless, except for learning French vocab and helping my stepdad with various data processing tasks.

For anyone else, particularly those learning as adults, there really needs to be a specific problem they're trying to solve, for which learning to program is a means to an end. That's the Motivation, used here in its academic sense rather than in the sense of "grit" / "conscientiousness". There's a reason.

the Mentor

What I really lacked as a kid was anyone telling me that there were good and bad ways of programming, and pointing out the "unknown unknowns".

That was until I was almost an adult, and I encountered Dan Shearer. Dan came to teach a programming course at my school, hosted via the Computer Society. He was implicitly very critical of the sort of programs I wrote. Even in BASIC it is possible to structure data logically in records, and use subroutines sensibly and so on.

The only really useful guidance I got as a child was from my Uncle Gregory, who spelt out the reality that usually programs need to subserve a commercial purpose, and that there was therefore a tradeoff against correctness, efficiency, elegance and so on.

the Machine

This one is no longer such an issue now that Raspberry Pi's have made simple computers affordable: you can't have kids experimenting on the machine that Mum and Dad use for work.

It is possible to learn about programming the abstract, like maths, without the actual machine; my stepfather taught me all about chaining logic gates together without either of us ever trying construct such things physically. Certainly you can write subprograms like this, and this kind of thing was still common by the 1990s. I think it's mainly restricted to whiteboard coding in interviews nowadays.

the Manual

Nowadays the machines people write code for are well documented; learning, you need to be able, at your own initiative, to look up the answers to questions in an authoritative source, and explore that source to discover "unknown unknowns".

The safeguarding restrictions on Internet use by children are a bit of a threat to self-taught kids learning to program, for entirely understandable reasons. Of course it's possible to ship adequate docs with a machine, but it doesn't feel the same.

Conclusion

It's probably a bit odd to have learnt subroutines, trigonometry, assembly language and memory management at home before even learning algebra at school. I recall a lot of trouble understanding what 'x' was and how it could be different in different scenarios, and how the 'x' discussed in Maths lessons was confusingly different from the 'X' variable in BASIC.

But having symbols that refer to values is the very heart of programming computers, and I'm glad I picked it up when I did.

Link

Link

Gemlog index

Site index


Source