Re:Discovering Dennis Ritchie’s Lost Dissertation
by RHSeeger on Saturday June 20, 2020 @11:17AM
(#23584400)
I tend to go with whatever makes the code the most readable; best expresses the intent. If I'm iterating over a list, mapping each element to a lookup somewhere, and then removing those that weren't found... that's a good choice for functional. If I'm iterating over a list, if it matches one thing do something, otherwise filter it some more and do something else... I tend to find procedural is easier to read. Maybe it's a transform vs act-on type of thing; I'm not sure.
The move to functional-style code the last many years seems a bit silly to me. Even C++ has been moving in a well-known trend of "no raw loops" in favor of the algorithms header in STL. I don't find there is a significant reason to abandon easy code most of the time. If you actually need to use the functional paradigm to swap out behavior in a polymorphic fashion using functions instead of inheritance, for example, then great.