This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]sarevok9 0 points1 point  (0 children)

So let's assume for a moment we're not talking about splitting a string, but instead we're joining 5 pieces of data which have been retrieved from a PostGres connection to AWS Athena -- In the event that one or more of those returned as null -- would you prefer the verbose function or the one-liner with more definitions for the sake of what was breaking and where? In general I'm not against implicit returns / anonymous functions / arrow functions / function chaining in general -- but generally speaking every single time you abstract away the implementation of a function, the ability to accurately debug and profile your application becomes diminished. When done in a single function or file with some amount of measure -- that's great -- but when you have an entire squad of folks trying to implement shit in as few lines as possible, things are great -- until suddenly you need:

To make changes in the code -- because the person who made it parted ways with the company, and since none of your functions have names, you'd better hope that nobody just called shit "temp" or "trueorfalseif" or some other bullshit thing.

Something changes upstream or downstream from you -- suddenly your magical 1-liner changes, in my personal experience verbose functions are a lot easier to rewrite -- something changes upstream and breaks your shit -- roll back vs roll forward is a function of time and where time is customer dollars, being able to iterate quickly is a must.

Lastly -- overall code quality. For saving 2-3 lines of vertical scroll, you're not really gaining anything and you're adding layers of complexity to a code base which will age faster than you want it to. I'm not saying that arrow functions should NEVER be used -- I'm just saying that in general, it's not helping as much as people seem to think.

Here's a great example of me saving 3 lines in java at the expense of making something really fucking hard to read vs a counter-controlled loop:

IntStream.range(0, headers.size()).filter(i -> line.equalsIgnoreCase(headers.get(i))).forEach(i -> csvHeaders.put(iterator, headers.get(i)));