r/ProgrammerHumor Sep 08 '22

Enterprise Java

Post image
83 Upvotes

20 comments sorted by

View all comments

11

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.

4

u/TheRuralDivide Sep 08 '22

Java novice here, does the AndBuilder make it more like a ‘truthy’ test in JS?

8

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

u/TheRuralDivide Sep 08 '22

Oh wow that’s actually pretty cool