• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

[Functional Programming in Java] How has Java evolved towards functional programming?

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
With Java having been an object oriented programming language for roughly 2 decades, how has it adapted towards the functional mindset which has been gaining popularity since the early days of programming? There are many other functional programming languages out there. And they are more often than not better at functional programming than Java is. Why will people use Java to do their functional programming?
 
Author
Posts: 161
31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Joris,

Java has not evolved much toward functional programming. Lambdas are a great addition, but they are not specific to functional programming, although they make it much easier. Functions are useful too, but they are so simple to create that it does not count for much. Optional, Stream and CompletableFuture, although they are Monads, are not implemented in a way that makes them much useful for functional programming. But functional programming is not tied to any language. It's a programming paradigm. It's easier with functional friendly languages, but it is possible in any language.

But the most interesting part of you question is "Why will people use Java to do their functional programming?". This leads to another question: "Why would people have some functional programming to do?"  This means that you have some functional programming to do and must pick a language for that. Choosing Java to solve software problems is questionable. Generally, you chose the language you know. Otherwise, it can't be an educated choice. So you have to first learn a language in order to be able to make the choice of, eventually, using it (or not). But choosing Java to solve functional software problems would means that being functional is a goal, and not a mean. I can think about few use cases for this. For example if you are student in functional programming and are free to chose a language. But I would certainly not recommend Java for this.

Most often, the language is imposed, whether it is because of  environment requirements, or because you work in in team, or because you have to deal with legacy code, or all these reasons at the same time (as in my own case). So the choice is not which language for my functional programming, but which paradigm for my Java programming.
 
Joris Renting
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That makes sense. Thank you very much!
reply
    Bookmark Topic Watch Topic
  • New Topic