Functional programming is the libertarianism of software engineering
This is a pretty dumb post, in which I argue that functional programming has a lot of the bad parts of libertarianism and a lot of the good parts:
- Both ideologies strive to eliminate [the] state. (ok, dumb dad joke)
- Both ideologies are driven by a set of dogmatic axioms rather than a practical goal:
- Libertarianism wants to reduce the government because any involvement distorts free markets. I always struggled to see what the underlying objective function is (it doesn't seem to be maximization of people's utility). 🤔
- Functional programming wants to reduce side effects and make everything pure, often by enforcing onerous type systems. But why? Again I don't see an ultimate objective here. IMO it should start from the principle that the goal of a programming language should be to make the programmers as productive as possible. For instance, the little research that exists has shown that most bugs have little to with typing and I'd expect something similar to apply to mutable state. In fact the largest class seems to be poor error handling (ok, typing isn't necessarily related to FP, but in practice I find that strong typing and FP have highly overlapping fan clubs).
- Both camps invoke obscure cases in history as a proof of success: libertarianists (more so anarchists I guess) often talks about Spain during the civil war, Somalia, or sometimes Singapore. Haskell acolytes are very eager to bring up Facebook's spam filtering.
- YET – and this is the surprising part imho – both ideologies are ~90% correct (source: my opinion). Which really surprises me given that they start from a (imo) arbitrary set of axioms.
- Even if you are a die hard bolshevik, you benefit from an understanding of how interventions distort markets, how incentives matter, and how entrepreneurship is the driver of progress.
- Even if you are coding in Visual Basic, you can level up your skills by learning FP: making functions pure when needed, avoid state, avoid reassign variables, avoid mutable data structures, write pipelines of data transformations, and all that jazz that FP has taught us to cherish.
End of stupid post.Tagged with: misc, rant