What Is It About Code That Makes It Valuable?

I believe that code is valuable when it works and it can be changed.

I find this way of thinking to be useful in two ways: (1) it reflects my latest understanding of what it means to be valuable code and (2) it helps me to coach people to create valuable code.

When I first started writing code all that mattered to me was that the code worked. I started coding in high school using mark sense cards. They were like punch cards but you could use a pencil to mark the cards with your program rather than using a card punch machine. At the end of every day a long cardboard box of cards was transported from my high school to the Ottawa School Board’s mainframe. Some three or four days later, the box of cards would reappear along with any printouts. As turn around time for fixing a syntax error was three or four days, I learnt to always be very careful to check my code for syntax errors before submitting to the mainframe.

Even so, I would still make syntax errors. Once I had fixed the syntax errors and my program would compile and run, I usually found that I had made both goofy and subtle logic errors. Since each run of the program was so valuable, I included lots of print statements to instrument the dynamic behaviour of my simple programs. Eventually I would get my program to work. Once my program was working there was no reason to change it. I would strip out all my diagnostic print statements and hand in my program listings for marking confident that I wouldn’t have to ever change the code.

I think that when most people start to write code their overwhelming goal is to make their code work. My early experiences with coding affected my attitudes towards code in that once my code worked I was done with it. Now when I coach people about coding my most hated response to my hints is “sure, but why do anything since the code works.” As long as I cannot convince programmers that it works is a necessary but not sufficient condition for valuable code I’m finding that I’m not making very good progress with my coaching.

Once I add “and it can be changed” on to the end of my definition of valuable code I have some leverage against programmer indifference. I can say “you’re right it does work but is it easy to change?”

Leave a comment

Your comment