The wings of a programmer

12 Apr 2015
2015/04/12

Programmers think programming is really hard.  Non-programmers think it’s even harder than that.

Figure 1: The perceived difficulty of programming. perceived_programming_difficulty

Why is programming so arduous?

There are a few reasons.  Here is one.

Wings

Programming is exacting, programming needs creativity.

These are absolutely at odds with each other.

One wing wants the programmer to respect every minuscule triviality.  The other wants the programmer to conceive a scintillating new creature that fits seamlessly into an existing ecosystem.  Getting either of these out of one particular homo sapiens brain is a lot to ask.  Here we are, wanting both at once.

Failure mode 1

Do the details, ignore the creativity.

This gets you code that runs, that passes the existing test suite.  But code that is a dead end.  Ask one more thing of it and it falls apart.  The code is likely to be verbose.

Failure mode 2

Do the creativity, ignore the details.

This gives you code that doesn’t do much of anything (if you get any code at all).

Failure mode 3

Do details and creativity simultaneously.

This is frustrating for the programmer and frustrating for the eventual users.  Trying to do both of these at the same time means that neither gets done.

Premature optimization is the root of all evil

— Donald Knuth

Simultaneously doing details and design is a form of premature optimization.  Plus, brain rule #4 suggests that trying to do them both at once is, at best, inefficient — gist should come before details.

Better

Better is to use both wings, but — unlike a bird — flap one for a while and then the other.  Not like a bird, more like Paul Bunyan’s dog Sport.  Sport’s back half was sewn on upside down after he was accidentally chopped in half.  This turned out to be a good thing: when he got tired of running on his front legs, he would just flip over and run on his back legs.

First mold your new baby so it fits into the current milieu.  Only once it seems to have a good shape should you worry about it doing everything correctly.  Worry whole hog.

Failure mode 0

Real programmers know that numbering starts at zero.  Indeed there is failure mode 0, which is:

Don’t program at all.

See also

Tao Te Programming is mostly about the things that make the line in Figure 1 slope back up.  It also suggests additional ways to make programming easier for beginners.

Epilogue

There, upside down (unlike a Bird),

— from “The Sloth” by Theodore Roethke

Appendix R

Figure 1 was produced in R with the function:

 P.perceived_programming_difficulty <- function (filename = "perceived_programming_difficulty.png") 
{
  if (length(filename)) {
    png(file = filename, width = 512)
    par(mar = c(5, 4, 0, 2) + 0.1)
  }
  pdiff <- stats::splinefun(1:4, c(11, 2, 7, 8.8), method="natural")
  curve(pdiff, 0.5, 5, lwd=6, col="darkblue", xlab="Experience",
    ylab="Perceived difficulty", axes=FALSE, xlim=c(0.4,5))
  axis(1, at=c(0.7, 2.6, 4.5), tck=0, c("none", "some", "lots"))
  axis(2, at=c(3, 9, 15), tck=0, c("easy", "really hard", "really really hard"))
  box()
 
  if (length(filename)) {
    dev.off()
  }
}
3 replies
  1. Lisa says:

    Nice observations and programing jokes!

    Reply
  2. Cole says:

    Thanks for sharing your insight!! I have been ‘coding cowboy’ on an R project for the past year and a half and can definitely relate to the struggle outlined above. Thank you for articulating things so clearly and sharing your wisdom on how to work through things the optimal way. This will definitely be useful moving forward.

    Reply
  3. Cole says:

    Also, I tweaked your code a bit to make a PDF version so I could hang this over my desk (SVG for the win). For those that are interested…

    P.perceived_programming_difficulty <- function (filename = "perceived_programming_difficulty.pdf")
    {
    if (length(filename)) {
    pdf(file = filename, height = 8.5, width =11)
    par(mar = c(5, 4, 0, 2) + 0.1)
    }
    pdiff <- stats::splinefun(1:4, c(11, 2, 7, 8.8), method="natural")
    curve(pdiff, 0.5, 5, lwd=6, col="darkblue", xlab="Experience",
    ylab="Perceived difficulty", axes=FALSE, xlim=c(0.4,5))
    axis(1, at=c(0.7, 2.6, 4.5), tck=0, c("none", "some", "lots"))
    axis(2, at=c(3, 9, 15), tck=0, c("easy", "really hard", "really really hard"))
    box()

    if (length(filename)) {
    dev.off()
    }
    }

    Reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *

© Copyright - Burns Statistics