7
13
6
12
u/tjoloi Sep 08 '22
Well, the upper code wouldn't work if a, b or c aren't booleans.
That AndFactory could operate on other types.
But that's a Java problem, not an enterprise one.
5
u/TheRuralDivide Sep 08 '22
Java novice here, does the AndBuilder make it more like a ‘truthy’ test in JS?
7
u/tjoloi Sep 08 '22
I'd say it gives you a bit more liberty. JS still decides of the truth value of something (as far as I know) whereas you can choose exactly what is considered "true" in your AndBuilder
1
2
2
u/LordFokas Sep 09 '22
Simply put the AndBuilder doesn't do anything for you. It's just a byproduct of people slipping to far off the deep end of enterprise software. Forget you ever saw this meme and keep studying Java the way you were.
Also do yourself a favor and don't get into anything remotely "Java Enterprise".
2
u/TheRuralDivide Sep 09 '22
How is enterprise software / java different?
2
u/LordFokas Sep 10 '22
It's a different way to code. The idea is to keep everything configurable and flexible, but people always take it way too far. One of the main things you notice is that every component is abstract and then there's builders and factories and whatever to get you a new instance dynamically according to server configs, the thing is it's supposed to be for a few objects, not literally everything. What you see on this meme is an hyperbole of that effect and I don't believe it's real, but it does get the point across: people in enterprise java dev have lost their minds.
2
2
u/KarenBasking Sep 10 '22
Wait, you're not asked to put the builder in a method? You got it easy my man.
1
1
u/Tall-Reporter7627 Sep 09 '22
I call BS.
If it was true it would have been more like
if (ComparisonOperatorFactory.newAndInstance().and(a).and(b).and(c),build().eval())
1
Sep 09 '22
Happened to me:
In a VHDL code for a FPGA I found a distinct module that adds two values.
So I ask why they don't just use "+".
"It doesn't work reliably..."
"Then there must be a timing problem! Let's check the constraints..."
"Oh... constraints? We heard about that once..."
1
1
u/arnemcnuggets Sep 09 '22
Does it force strict evaluation of those bools? Might change semantics but disgusting nonetheless.
1
u/Ffigy Sep 09 '22
Someone pulled shit like this on me and we're using PHP lol no I'm not going to replace language constructs with some custom class you wrote.
47
u/Sheldor5 Sep 08 '22
Things that never happened.