• 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

 
Scott Shipp
Ranch Hand
Posts: 224
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?
 
Richard Warburton
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!