Re:Simple Ways of Reducing the Cognitive Load in Code
by andrewprock on Tuesday June 28, 2016 @10:54AM
(#11994240)
While some people may like to read code that looks like SQL, I've found Java 8 features like this are poorly supported by the debugger, so debugging stuff like this tends to require "horse whispering" or rewriting the logic into something that can be stepped through.
Re:Simple Ways of Reducing the Cognitive Load in Code
by amirouche on Tuesday June 28, 2016 @01:32PM
(#11995708)
GNU Gremlin is a stream API to traverse graphs.
Re:Simple Ways of Reducing the Cognitive Load in Code
by eru on Tuesday June 28, 2016 @07:31PM
(#11998413)
That reads more like Haskell than like SQL. (Doesn't have any bearing on the rest of your point one way or another.)
Re:Simple Ways of Reducing the Cognitive Load in Code
by amirouche on Tuesday June 28, 2016 @01:25PM
(#11995627)
I think it reads better with intermediary variables. Granted sometime you go to name an intermediary variable that does two things (just like male_siblings = (2 * (X + Y)) if I have a brillant idea for the variable name.
Yes it requires learning several new concepts, but in the end it pays off.
BTW I wouldn't switch old code to this style, because there never seems to be time for that. But new code written like that is perfectly OK IMHO.
EDIT: I really should've checked the code more carefully - the initial version had no indexing variables. Still, it reads better and has less boilerplate.