09 October 2011

Why Programming is Hard

Programming is not hard because computers are fussy. Programming is hard, but not for that reason.

There are plenty of pesky surface details in managing programming projects and programmers regularly find themselves burdened with managing tools and configuration details. More so when using Maven (Zing!).

But this is just work. Annoying repetitive work. It's not what makes programming hard.

In fact, programming is hard because there are so few limits to what you can do.

Certainly there are limits to computability, and there are famous problems and algorithms that define the state of the art in computer science, but for many programmers, knowing about these limits is enough to prevent them from pushing up against the hardness of these limits on a regular basis.

Programming is hard because the only limit is our own mental capability. It's always going to appear to be hard. It doesn't matter how smart you are.

If programming is not hard, then you're doing it wrong. Your brain is not being fully utilised? You are being limited by your tools and you need to replace them.

Any time spent dealing with repetitive details, remembering lots of things or even managing huge amounts of code, this time waste generally can be eliminated with more programming! This assumes you're in a postion to change the system enough and perhaps this is where practical project tradeoffs impose. And perhaps "the business" isn't interested in funding improvements to the open source build tool, or switching from Java to Scala. (Double Zing!) But those are not programming problems.

For me, because software is so soft, the goals can be altered subtly, continuously, destructively. Especially when ill-defined. The hardest thing generally comes down to dealing with the confusion of some form of not being clear what I'm trying to do. Unravelling the "is it this or is it that" trail of mental plans that led to the curent state. When this happens in the large, a software project is almost certain to fail.

But maybe that's just me. Do you think programming is not hard? Do you think it's hard for a different reason?

3 comments:

  1. For me its hard because constructing useful mental models of the execution is hard. We have abstractions to help, but these usually only capture part of the problem, or they become complex or abstract enough that they are themselves difficult beasts to master.

    What I find the hardest stuff about programming is the composition of side-effects, particularly when that composition may be non-deterministic (basically, concurrency).

    ReplyDelete
  2. Good point Jed. I think the abstractions that are totaly abstract - they have no apparent analogue in either the domain or the "metaphor" of the system can be hard because you have to keep the meaning afloat in your mind by brute force. You can't rely on recognition of the name. I think the LongMultifacetedNameWithComponentsThatExplainTheAbstraction style can help (kind of like the German language!) even at the expense of line length and compact layout.

    I wonder to what degree that concurrency and side-effects stuff is purely "accidental complexity" and can be eliminated with better tools.

    Do you think functional programming can remove most of that difficulty?

    Interestingly lots of programmers report that functional programming languages themselves are "hard" - but perhaps they just mean unfamiliar.

    ReplyDelete
  3. I come back to this to link to Rich Hickey's (a personal hero) http://www.infoq.com/presentations/Simple-Made-Easy Simple Made Easy. Hard is the opposite of easy, but sometimes it is hard to be simple. Yet, in the long run, it may be easier to be simple, but perhaps only in the long run. Anyway, Rich has a much better overall explanation…

    ReplyDelete