Yes and no. This is a common pattern, but implemented very lazily. Most of this can (and probably should) be refactored out to separate classes/functions.
But no, I don't think this would faze most Java devs. It's ugly and bad practice, but more or less acceptable depending on personal taste. It works, at least.
Point of interest: LLMs tend to go too far in the opposite direction with code like this. They will break everything apart into functions or classes, even trivial one-line lambdas. I find that even more obnoxious than the monstrosity you linked.
I can tell you as a person working in a spring boot webflux shop that is pretty bad code. You really don’t want to nest that much. Using atomic references outside the reactive flow is a huge red flag that they don’t know how to program in webflux properly. Not that webflux is easy to use at all and the dx is garbage.
> Not that webflux is easy to use at all and the dx is garbage
My experience with pretty much any Java framework ... It's sad because I do think (especially since Java 8) that Java is a great language for many things. But the community as this insane tendency to create incredibly convoluted pattern-on-top-of-pattern tooling.
I think this perspective explain the issue well: you pretty much cannot unit test this (unless you consider the whole function a unit). It becomes very unclear what each lambda expression is about, the deeper you get.
I don't really know Java, but .flatMap(...) seems to be equivalent to C# .SelectMany(...) which famously can be interpreted as a monadic bind operator.
The C# query syntax
from x in xs
from y in GetYs(x)
from z in GetZs(y) ...
which is similar to monadic do-notation in Haskell.
So since there is monadic Scala code elsewhere in the project, I wonder if this is a result of someone thinking in Scala and translating it into Java in their head.
If you are a non-Java developer, it does look daunting. But in my opinion it’s much much better use of the Java streams api and reactor library that I have seen compared to most shitty corp firms.
I saw an internal “sso” auth app that iterated a byte array and concatenated the values into a string instead of base64 encoding it when I worked at HP/HPE/DXC
Fuck no, it's not. But I've seen it because it gets promoted by some smartass tech lead chasing so called webscale performance. But they never do comparative benchmarks against regular blocking code for fear that it would demonstrate the true nature of their head trip. Then they leave to go shit elsewhere and leave other people to deal with the consequences of their hubris.
Wow, that's frustrating code. I feel vindicated in using an ultrawide to code with. When I mentioned on here I use it because sometimes you have to work on code with super-deep indents I got downvoted to negative infinity for shitty code management.
https://github.com/IRS-Public/direct-file/blob/9dd76a786ea69...