Monday, May 20, 2019

Coding and Essays

Coding and Essays

“A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects.”
― Robert A. Heinlein

By Bobby Neal Winters

I like to program computers.
I began back in the late seventies when I was in my mid-teens on a TRS-80 microcomputer that my high school had bought.  The math teacher (there was only one) didn’t know how to program it or have the time to learn, so he flopped the manual down on my desk and said to figure it out.

So I did.

From that day until this, I’ve had exactly one class in programming...and it shows.

From day one, I’ve approached computer programming as a problem solver, a redneck problem solver.  You’ve no doubt seen those pictures on Facebook of someone who has put a ladder in the basket of a cherry-picker to get to some hard-to-reach place to paint. Most of the code that I’ve written over the course of my life has looked like that.  My programs have been like Rube Goldberg devices: they do what they are supposed to, but not necessarily in the most straightforward way.

There is a solution to this, and it is amazingly similar to the way to improve writing.  It is...wait for it...rewriting.  Learning to rewrite was a revelation to me.  The fact that my words were not necessarily fit to be carved on stone was a hard lesson to learn, but when I did learn, I was a massive step forward.  (There are no doubt those of you reading this now who would tell me that I need to do even more of it, and I would agree.)

We are reluctant to rewrite our prose for many reasons that may include but need not be limited to: writing is hard for us in the first place; we really don’t like to write; and our belief that what we’ve written is just so marvelous the way it came out of our heads that it couldn’t possibly be improved.
These particular reasons can be taken care of by practice.  The more we write, the easier it becomes.  When something becomes easier, it becomes more enjoyable.  And when we return to a piece, look at it, and not understand it even ourselves, the penny drops and we realize that not everything we write down is golden.

Rewriting computer code is quite similar. Sometimes the programming problem is so treacherous that we feel lucky there is any solution at all.  The thought of reworking the problem seems ridiculous. Why waste your time rewriting unreadable code, when you could use it do go out and write more unreadable code, hmmm?

One gets insights in coming back to code that you have written a year before, needing it to solve another problem, but not being able to use it because you cannot make heads or tails of it.  When this happens a time or two, you start trying to be clearer.  Once you’ve gotten your code to work, you go back over it and make sure that it will be readable to your future self.

If you start taking this stuff seriously, it has an effect on you.  You see how well it works.  The approach spreads into other areas of your life.  From writing, to computer programming, to you name it.  You learn that you can stick with a job until it is done right.

This habit is the product of an education. Don’t misunderstand me by thinking this can only happen in school. No, far from it. If you’ve learned this in your home from your hard-working parents, then you are way ahead when enter the world. 

I’ve seen a quote on my Facebook feed from my South American friends: La escuela es la segunda casa, pero la casa es la primera escuela.  This translates as: The school is the second home, but the home is the first school.  The habit of hard work and the desire to do something well set us on a pathway to success in our endeavors.

So whether you are coding a computer program, writing an essay, setting a bone,  fixing a car, or whatever other task you are doing, the idea of sticking with it until it’s done right will pay off.

Bobby Winters, a native of Harden City, Oklahoma, blogs at redneckmath.blogspot.com and okieinexile.blogspot.com. He invites you to “like” the National Association of Lawn Mowers on Facebook. )