Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

Functional Programming in Java: for Java ME?

Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Pierre-Yves,

I'm pretty much a Java noob and have been using Java ME to create MIDlets to access I2C sensors on the Raspberry Pi.  Will functional programming techniques substantially improve my code using Java ME?


Posts: 161
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bruce,

Functional programming techniques will improve any kind of programming by making programs safer and easier to test and to reuse. This said, it might not help so much when interacting with libraries that are not functional themselves. In such case, one has to wrap the non functional library into a functional wrapper. For example, if a library throws exceptions as a mean to communicate about exceptional conditions, you have to translate these exceptions into a functional representation.

Another problem is that functional IO is one of the trickiest part of functional programming in Java because Java lack the necessary elements for this, so you have to develop you own IO functional library. Programs that are constantly performing IO over time are the most difficult to make functional, and it might not be worth it. But only you can decide, and for this, you have to learn how to do it!

To summarize, probably not all functional techniques will be beneficial in your case. But the main problem is that it is practically impossible to evaluate the benefits without understanding how it works. So you have to check for yourself. What I would suggest is reading the first chapter (available as a free download), and see if looks promising.
If somebody says you look familiar, tell them you are in porn. Or in these tiny ads:
Free, earth friendly heat - from the CodeRanch trailboss
    Bookmark Topic Watch Topic
  • New Topic