How learning to code might improve writing skills

How learning to code might improve writing skills

Look, I'd like to point out straight away that I'm not a pedant. I'm happy to blithely split infinitives whenever the opportunity presents itself. I avoid the avoidance of ending a sentence with a preposition because, as Sir Winston Churchill said, "that is the kind of English up with which I will not put". And as for not starting sentences with a conjunction, I don't see what the problem is as long as it all reads nicely.

However, one thing I do insist upon is that people say what they mean, even if they don't mean what they say. When I am left in doubt as to what the writer is actually saying, I think there's been a failure in communications, and not necessarily on my part.

Take a sentence like "Being a lover of good food, the meal was excellent." Say what? How could a meal be a lover of good food? Well, we all know what the writer meant to say, but that's not the point. It's sloppy writing, and the reader has to do a bit of extra, unnecessary work to sort out the meaning.

Here's another example, which I saw in a station:

Sign seen in a station. Photo by Terry Freedman

It conjures up a comical and unintended image, but again, we can work out what the writer was trying to say.

The reason we were able to rescue the writer in each of these cases is that we're not stupid. We can use past experience and common sense to, as it were, fill in the gaps. Computers, on the other hand, are stupid, and they interpret everything literally.

There are skills involved in writing a computer program that ought to be very helpful when it comes to writing in general:

Have a plan

There's no point in just starting to write a load of code. You should at least have some idea of what you want to achieve. One way of doing this is to draw up a flowchart of what needs to happen when. This is not too dissimilar from the technique of storyboarding. In fact, you could think of a flowchart as a storyboard condensed into one page. Drawing up a flowchart is an excellent way of organising a piece of writing in advance.

Be explicit

I've sometimes read stories in which the author writes something like, "He picked up the book and...", and I'm thinking, "What book? When did that appear?". I scrabble back through the pages, only to discover that this is the first ever mention of the book.

A computer program would not allow that. If you write a line of code that says, in effect, display "Hello, Name", the computer will respond by saying "What is Name? You haven't defined it."

There's an excellent example of how explicit you have to be in giving a computer instructions in Phil Bagge's video of how he played the role of a "sandwich bot". His 10 year-old pupils had to program him to make a sandwich. The results are hilarious:

Being explicit, at least in the sense of keeping track of your characters, arguments or evidence, is a good discipline to learn when it comes to writing too.

Be economical

I have a theory that only illiterate people try to impress others with their familiarity with obscure words. The adage "Keep it simple" applies just as much to writing as it does to coding. Extra and unnecessary lines of code in a program add to the running time. They also make it more complicated to figure out what has gone wrong in the event of an error. Good coding doesn't waste words, and that is also a useful skill to learn when it comes to writing.

Be purposeful

Sometimes in writing there is a point in "wasting" words". In Hamlet, Horatio's "But look, the morn, in russet mantle clad, Walks o'er the dew of yon high eastward hill." is slightly more poetic than "Look, it's sunrise."

But there was a reason for using such a description, just as in some computer programs you may need to insert more detail than strictly necessary, if only in the explanatory comments. The key thing, though, is to do so in a planned and purposeful way rather than because you didn't know any better.

"Creative" is not a synonym for "sloppy"

Many computer programs are incredibly creative and imaginative – just think of the apps that you probably have on your phone. But they only work because they have been written with precision. Adhering to strict rules, far from stifling the programmer's creativity, makes it possible for that creativity to be expressed.

Conclusion

The bottom line is this. The skills required to write a good program are, arguably, the same as those needed to write well in general. So, do have a chat with the person who teaches programming in your school, or even learn how to do it yourself. You may find useful parallels writing code and creative writing. At the very least, it opens the door to a different way of seeing things.

cross-posted at www.ictineducation.org

Terry Freedman is an independent educational ICT consultant with over 35 years of experience in education. He publishes the ICT in Education website and the newsletter “Digital Education."