On 15 July 2010 14:19, Wildam Martin <mwil...@gmail.com> wrote: > On Thu, Jul 15, 2010 at 09:54, Mario Fusco <mario.fu...@gmail.com> 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? > > > > 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). > > 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. >
This has to be taken with a grain of salt. Side effects are mandatory. IO is a side effect, so even in a pure FP you have to have a way to output the result of a function, otherwise you're just generating heat on the processor. And Haskell, as a lazy language, wouldn't even run anything. What you can do is try to isolate and reduce side effects (specially the non-desirable ones), so that you can reason about and test your application better. > > -- > Martin Wildam > > -- > You received this message because you are subscribed to the Google Groups > "The Java Posse" group. > To post to this group, send email to javapo...@googlegroups.com. > To unsubscribe from this group, send email to > javaposse+unsubscr...@googlegroups.com<javaposse%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/javaposse?hl=en. > > -- You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to javapo...@googlegroups.com. To unsubscribe from this group, send email to javaposse+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.