> On Thu, Jul 15, 2010 at 09:54, Mario Fusco <[email protected]> wrote:
> > What always surprise me is that
> > it often looks more similar to a religious or at least ideological
> > discussion than a technical one. Could please somebody explain me why?
>
> Maybe the reasons are similar as different people prefer different
> languages - depending on their actual needs and personal favors?

If this preference has a technical reason (i.e.: the project on which
I am currently working can be better implemented in OOP than in FP
because ...) I am perfectly ok with it. The problem is I rarely hear
justifications like that and far more often something like "I don't
need that FP crap!".

> > Of course I don't want to give up to all the benefits of OOP, but I
> > don't think anybody is asking that. Scala is the demonstration of how
> > is possible to take the best of both these programming paradigms.
> > So why shouldn't we try to do the same in Java?
>
> I think you could code in functional style already in Java (ok, the
> standard libraries apart, but I am talking of the APIs you are
> building).

I am well aware that I already can code in a functional programming
style with Java and I hope I already demonstrated it with my project
( http://code.google.com/p/lambdaj/ ). That doesn't mean that a better
native functional support wouldn't be appreciated by the (hopefully
not small) part of us who would like to employ some functional
techniques in Java.

> From your link:
>
> > "Since every symbol in FP is final, no function can ever cause side effects.
> > You can never modify things in place, nor can one function modify a value
> > outside of its scope for another function to use (like a class member or a
> > global variable)."
>
> Guess what: "Side effects" are something completely usual and desired
> in many cases. I want to manipulate existing objects or want objects
> "talking" back and forth to some other component.
> Of course for testing you need to initialize stuff correctly - but I
> don't want to make testing easier and at the same time make the rest
> of my life more complicated.

I/O is the only side effect I can accept. Too often I have seen the
arguments of a Java method used to return an output instead of a mere
function input and in my experience that almost always leads to
unmaintainable, unreadable, untestable, ugly code.

Mario Fusco
twitter: @mariofusco

-- 
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to