When was the last time you read through someone else’s code, not because you were looking for a snippet to pinch or because you’ve been saddled with debugging it; but for the sheer joy of reading someone else’s elegant, witty, creative code?
Modern computer systems couldn’t function without it, and it’s at the heart of nearly every modern software development. And yet, the very mention of its name is enough to strike terror into the hearts of even hardened developers. Why is multi-threading so difficult?
For more than thirty years, alongside conventional language development, there’s been a small but thriving culture of functional languages. These are not like the languages we all know and love. Their most obvious property is that they contain no variables at all; instead, they describe truths about the problem to be solved.
As anyone with even a passing familiarity with functional programming knows (and I accept that passing familiarity usually comes only after three to five years), things in a functional language don’t do anything (the way procedures execute or variables change in conventional languages); instead they are something, and what they are never changes. A term may describe a function which defines a list of primes, or it may describe what it means to be an expression, or what-have-you. But whatever it is, it describes it once and for all time – the function is the list of primes, it’s not a sequence of operations to compute the list.
Proponents of functional languages claim that by talking exclusively in terms of values, you get shorter, simpler, and more reliable programs. If things are things, rather than do things, they reason, then if they ever work, they’ll always work. If nothing ever changes, where can a bug hide?
The two pillars of modern software design are objects and exceptions. Objects allow us to partition very large systems into smaller, comprehensible chunks, and exceptions keep them running smoothly, by protecting them against malfunctions.
Funny thing is: though modern software is huge in comparison to the old-fashioned variety, it doesn’t seem any more reliable. Even though everybody knows that exceptions make programs better, I’ve never yet seen any real evidence that shows any reason even to suspect that it’s true. In point of fact, I don’t believe it, and I rather suspect that in most cases, exceptions make matters worse. Continue reading