Re:Simple Ways of Reducing the Cognitive Load in Code
by plorkyeran on Tuesday June 28, 2016 @10:50AM
(#11994209)
I find the code in the linked article much more readable than that. You've introduced a huge amount of noise that makes it hard to see what the actual operations being performed are.
[ Parent
| on HN ]
Re:Simple Ways of Reducing the Cognitive Load in Code
by rakpol on Tuesday June 28, 2016 @09:41PM
(#11998966)
I agree to an extent ... this example is pretty contrived, but when you start getting around ten filter/map/groupby operations in, it gets a little difficult to follow what's supposed to be happening. So typically, my first step towards breaking it out into a method is separating out the individual streams like above. As is mentioned in a cousin comment, it also looks a lot nicer with type inferencing, but alas we are stuck with the verbosity of standard Java 8 for now.