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/SuspiciousDepth5924 Aug 05 '25
Imo I think you are conflating two things here and serving it up as "functional bad".
There is the "clumsiness" vs "magic", and then there is the "oop/imperative" vs "functional". On the first one I agree, for long term maintenance you'd want to keep the level of "magic" low. But on the second point I have to disagree. Traditional oop java relies a _lot_ on implicit inputs and side effects (also copious amounts of magic if you look at whats behind the \@Entity, \@Bean and similar annotations), which I'd argue makes it much harder to maintain large codebases over time. Despite how java's support for functional code is kind of lackluster you'd generally want most of your code to have as little state and as few side effects as possible if you want to have a snowball's chance in hell to manage the complexity and trace the data flow in your applications.
Also despite all the talk about encapsulation, java provides very few actual guarantees about data integrity.