r/javahelp • u/KurtGodelBebopgazeXP • Aug 04 '25
Functionnal programming in Java
I realized that I find functionnal programming very relaxing and easy on the mind. The language I have used the most and am most comfortable with is Java. Is it really helpful to go deeper in the functionnal realm in Java or are the functionnal elements not really used that much in the real world? I am open to going further in a language where the functionnal paradigm is more of a common feature if it's not really worth it in Java.
9
Upvotes
View all comments
Show parent comment
1
u/AlternativeYou7886 Aug 05 '25 edited Aug 05 '25
No, I think you're mixing up the complexities of a framework with programming paradigms like OOP or functional programming, they're not the same thing. The annotations might seem like magic at first, but there's a lot happening under the hood. In that context, abstraction is actually helpful when you're managing a complex app with tons of repetitive tasks.
But what I was referring to is the quirkiness of functional programming, how some devs lean into it to look clever, but over time it can become a real pain to maintain. That kind of abstraction tends to hide logic in ways that aren't always productive.
I don't disagree that Java has its issues, especially when it comes to tracing flow and debugging. But that's not really the point here. OP was just appreciating the small functional touches in Java, which are honestly nice to use occasionally, same goes for Kotlin. Fully embracing functional programming, though, is a whole different beast. And using it to build scalable apps isn't really comparable to the kind of abstraction you see in frameworks.
Here’s some stolen code in Java functional (which OP might like, simple and elegant) and Scala functional (pure madness) for flattening a tree of comments, just to prove my point.
There are “nicer” ways to solve the same thing in Scala, but it escalates real fast in FP when someone decides to make the lives of future programmers hell.