8 ms·
I don't want to write an essay for an answer. I wish the author the best of luck in realizing their error. I used to feel the same way. I wrote and blogged abo
by DanielBMarkham 3y ago
I don't want to write an essay for an answer. I wish the author the best of luck in realizing their error.
I used to feel the same way. I wrote and blogged about it, then did a bunch of research. I feel that this journey of ideas I took was the most important of my programming career. There's some extremely interesting stuff in how this guy is wrong.
In short, they are opposite things. In pure functional programming, the two are exact opposites. Mutable imperative programming gets fuzzy, which is why it tends to be so verbose. If you think about it, pure functional code without OO doesn't need variable names. The programmer's intent has been completely extricated from the implementation. We start adding a bunch of words to convey our intent to ourselves and future coders. Eventually this naively begins to seem as if we're actually communicating in a human language. Make the code readable, I used to say. It's a solution not a mystery novel. Comments are always good/bad.
I miss those innocent halcyon days of yore. Happy that I grew, but it was also fun confusing these two entirely different epistemological domains and believing there was some value in that confusion. There was not.
- hnfong 3y agoCan you elaborate why you don't want to convey the programmer's intent in the code? I mean, sure, pure functional code doesn't need variable names (or even legible function names), but why would you want to write in that style?
- DanielBMarkham 3y agoBecause it shields you from implementation details, making your work orders-of-magnitude simpler as time wears on. Think of how you already interact with pure functions: bash piping, SQL statements, OS math libraries, etc. If you're expecting an int, you get an int. Now, it may be the _wrong_ int, but that's on you, not the coder. Implementation complexity goes away. Contrast that to how you might interact with a favorite JS library or framework. You do a thing that you think is right and the wrong answer or outcome occurs. 99% of the time your'e now researching SO and digging through somebody else's code trying to figure out whether it's you or them. Most of the time it's you, the code is good, but in either case you've mentally assumed responsibility for all this _new_ complexity that, by definition, is not related to the value you want to provide; it's just supportive. Imagine if every time we used these pure functional things if we had to grok around the web and dive into code. What would using spreadsheet by like? How would word processors help us? Can you imagine an accounting project that spent three years designing their own spreadsheet for this particular customer, or decided to use a dozen new accounting tools that had never been put together exactly like this? Yet this seems to be the most common way programmers do their work. It's completely screwed up, we're hurting both our industry and our customers by continuing to work this way, and we should be ashamed of ourselves frankly. There are plenty of examples of complex programming solutions being provided that aren't created and maintained this way. (rant continues)