Re:Advantages of Functional Programming in Java 8
by scott_s on Tuesday September 06, 2016 @10:16AM
(#12436143)
I think it's more than just syntax - it's culture. In C++, free standing functions has been a part of the culture of the language since the beginning. The design of the language encourages them - there are even cases, such as operator overloading, where it's preferable to implement it as a free standing function rather than a class method. In Java, when I write a class that is a collection of static methods, I feel like I'm fighting against the language and it's culture, even though they are sometimes used.
[ Parent
| on HN ]
Re:Advantages of Functional Programming in Java 8
by ivan_gammel on Wednesday September 07, 2016 @03:25AM
(#12441440)
How much do you write code on Java?
Such functional namespaces were part of Java from the very beginning (Math is a good example and with release of Java 8 now there are many more in standard library). I have not seen an enterprise project yet, in which there's no something ending with Utils or Helper, that is just a collection of functions. Such naming is an anti-pattern, of course, but still, almost every developer in Java world uses this and has it part of it's development culture.
Re:Advantages of Functional Programming in Java 8
by ajuc on Wednesday September 07, 2016 @04:00AM
(#12441546)
> Such naming is an anti-pattern, of course
This is exactly the cultural problem with too strict adherance to OOP :)
It's like people saying "nails are anti-pattern of course, but people still use them, so we've added hammer-heads to our screwdrivers".
Re:Advantages of Functional Programming in Java 8
by scott_s on Wednesday September 07, 2016 @10:11AM
(#12443509)
Yes, that was the point I was getting at. It's obviously part of how real Java code is written, but I feel like I'm going against how the language was designed when I do it. (Clearly, everything is not an object, and a class is not always the most appropriate way to group code.)