Re:Why Functional Programming Should Be the Future of Software
by yonaguska on Wednesday November 02, 2022 @03:06PM
(#33441300)
I'm trying to push unit testing, as a means to get rid of some of those negatives you pointed out. But it's not a panacea. And obviously, I don't want to test for the sake of it either.
Re:Why Functional Programming Should Be the Future of Software
by bbarn on Wednesday November 02, 2022 @07:08PM
(#33444131)
I'll be honest, most of the unit tests and integration tests I write are mostly because it's more fun than cranking out "features"
Re:Why Functional Programming Should Be the Future of Software
by leidenfrost on Wednesday November 02, 2022 @03:45PM
(#33441889)
Before learning FP I used to ask myself: "Assuming that by tomorrow my memory gets erased and my IQ diminishes by 50 points, will I understand this code?".
That's why I try to juggle the least amount of variables as possible at the same time, while trying to have my code to read like a cooking recipe or a very simple literature. From that, FP feels almost natural.
Even more so, I think that most software bugs and spaghetti code is made by people that were too confident on themselves. They thought they could handle a lot of random unrelated variables floating around all the time, while having their functions do a lot of random algorithms at the same time.
And yes, they could handle it. The first time. But, in the long run, most people forget, or they leave and another person ends up having to maintain it, and that super brief-and-clever code became an unmaintainable mess.
Meanwhile, FP is kind of a pain to connect things in, for most people.