Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Is there any class of problem you found is not a good candidate for lambda usage?  RSS feed

 
Ranch Hand
Posts: 239
12
Eclipse IDE IntelliJ IDE Java Scala Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since they are the hot new thing, it feels like everyone's talking about lambdas all the time. It's almost as if lambdas can be used to solve any problem. In writing Java 8 Lambdas: Pragmatic Functional Programming, did you find any areas where lambdas are bluntly the wrong tool for the job? What were they? Why do lambdas fail in these areas?
 
Author
Greenhorn
Posts: 22
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Scott Shipp wrote:Since they are the hot new thing, it feels like everyone's talking about lambdas all the time. It's almost as if lambdas can be used to solve any problem. In writing Java 8 Lambdas: Pragmatic Functional Programming, did you find any areas where lambdas are bluntly the wrong tool for the job? What were they? Why do lambdas fail in these areas?



Hi Scott,

Thanks for the question. I won't say that there's a clear-cut line where lambdas are right and where they are wrong. Its more like there's a spectrum where they are best suited at one end and worst suited for use at the other end. Lambdas are best suited to situations where you want to write short, pure, simple methods and pass them around into other code. The further away from that ideal you get the more I would choose not to use them. So the larger the method, the more it mutates state and the more complex the logic, the better off you are using regular methods.

regards,

Richard
 
That's my roommate. He's kinda weird, but he always pays his half of the rent. And he gave me this tiny ad:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!