4 ms·
I don't know if this is what made it click for me specifically, but here's an interesting realization I recently came to about mental models in programming. So
by Rayhem 4y ago
I don't know if this is what made it click for me specifically, but here's an interesting realization I recently came to about mental models in programming.
Somewhere along the line I conceptualized functions as a mapping from their inputs to their outputs, much like in mathematics, and I would later come to learn this is what's known as referential transparency[1]. Eventually, during a foray into functional programming, I discovered Lambda Bubble Pop[2] and thought it was brilliant because it was exactly how I had been resolving function invocations inside my own head pretty much for forever, and poof, higher-order functions just made sense. I recently showed it to a developer colleague of mine, though, and he had a very different reaction. In discussing with him, I gathered "replacing a function with its output" was rather alien as a concept; this was not at all how he thought about functions. I'm still trying to figure out how he does conceptualize functions, but I gather they're more lists of instructions than they are term replacements.
[1]: https://en.wikipedia.org/wiki/Referential_transparency https://en.wikipedia.org/wiki/Referential_transparency
[2]: https://chrisuehlinger.com/LambdaBubblePop/ https://chrisuehlinger.com/LambdaBubblePop/