3 ms·
I haven't programmed in C# or Jave, but I was recently looking into expository literature on why functional programming helps write more modular code [1]. I fou
by ssivark 9y ago
I haven't programmed in C# or Jave, but I was recently looking into expository literature on why functional programming helps write more modular code [1]. I found the following Haskell-based example to be really enlightening: http://yannesposito.com/Scratch/en/blog/Haskell-the-Hard-Way/#functional-style http://yannesposito.com/Scratch/en/blog/Haskell-the-Hard-Way...
I think it's okay to skim over the Haskell specific parts; what I really liked how the end result (version 10 of the program) is nicely composed out of orthogonal pieces, compared to version 1, which is a monolithic blob, while "simple". So, if you want to solve a related but different problem, you can reuse everything you've written instead of duplicating code. So any bugfixes/improvements to one part can trivially be propagated to all other use cases.
[1]: https://blog.acolyer.org/2016/09/14/why-functional-programming-matters/ https://blog.acolyer.org/2016/09/14/why-functional-programmi...