Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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

Figure 1: The perceived difficulty of programming.

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.

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),

## 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()
}
}

The post The wings of a programmer appeared first on Burns Statistics.