I'm starting to code again.
I hadn't typed a variable name or defined an object in years, but the other week, I remembered how much I loved it. I used to code in PHP, but this time, I sparked up a Linux VM and started to learn Python. I hadn't even entered a BASH command for a while, so I'm relearning everything from the beginning.
I found myself painfully tapping commands into the Geany
graphical editor, saving .PY scripts, and running them to see what happened, only to get the inevitable syntax errors and warnings. For the inexperienced, coding is a frustrating series of stops and starts, like turning over an engine that doesn't want to go.
It's delightful too, when a script finally sputters to life and does what you wanted. Mine processed an HTML file, finding domain names and converting them to IP addresses. When it was finished, it ran smoothly, churning out hundreds of lines of beautifully formatted results and saving them off to another file.
It ran smoothly, but it used far too much fuel. The best way to learn a language is to go over what you've just done and try to make it more elegant. I began refining it, looking for better commands to do more with fewer lines.
I gradually reduced the code, like a good sauce, consolidating commands, replacing five instructions where one carefully thought-out one would do. Any good programmer's ultimate goal isn't just to do something, but to do it well. There is such a thing as beautiful code - although mine will still be ugly for a while to come.
That's ok. Writing embarrassingly bad Python scripts is a hobby. Lord knows, no one would pay me for it, and most people are far better at it.
Luckily, writing posts like this is my day job. That relies on 'real' language, with a far more forgiving syntax. But as the Python interpreter kept telling me where I'd gone wrong, I realised that software code and real life language are intimately linked.
We build our realities through language. The agreements that we declare with people - our loved ones, our clients, our business partners, and ourselves - dictate what comes next. A poorly-worded or incomplete communication leaves things open to interpretation, and often leaves people with the wrong idea.
What happens then? Arguments develop. Feelings get hurt. People are left with different expectations, which can be explosive further down the line. I've had business partnerships - and the friendships underpinning them - collapse because I didn't know enough to code them properly. We have to code our lives properly. We have to make every word of our language count.
So, what does proper coding look like when we communicate with each other, rather than with a software engine? It means being clear, concise, and - to quote Don Miguel Ruiz
- impeccable with your word. That last part is important. Being impeccable with your word involves using positive language to describe the way you want things to be, rather than negative language that sets you up for failure. It also means following through with your stated intentions. People respect others who explain exactly what they're going to do, and why, and then do what they say.
Being impeccable with your word requires a careful, elegant use of language. Using language as a tool requires that we keep it sharply honed. Just because the syntax of the English language is broader than our software languages doesn't mean that we shouldn't be measured, elegant, and deft with our words. Wasting less time and energy on expletives and cliches lets us concentrate on meaning and structure. It enables us to better program our world, and our place within it.
French mathematician Blaise Pascal summed it up best in a letter he once wrote: "I have made this longer than usual," he said, "because I have not had time to make it shorter."
Smart chap. No wonder they named a programming language after him.