Piet Souris wrote:However, what gives me this mixed feeling, is that the first method
in your blog was very, very comprehensible. I just needed one look to
know what you were doing.
I think that comprehensible feeling is from comfort with the language. This is essentially Java:
Piet Souris wrote:
Then, looking at the last method in your block, indeed, powerfull, but I can imagine
someone looking at it needs at least two readings to understand what's going on.
(I'm not talking about all those FP experts around, of course).
This is the after. It took me two readings at the beginning. But the Java version wouldn't have been immediately obvious to me 15 years ago either.
One reason I like the functional version is there is less to remember at once. grep is UNIX for search (Java 8 doesn't call it that though). So I know that I'm filtering the items for disabled. Then I can forget that and go on to the rest which is getting the names. In a longer chain of actions, this impact becomes more noticeable. I can replace three levels of nested loops with a functional programming chain.