As many people have stated out there, the correct use of lambda expression to revamp some old search functions in previous java versions, could cut the code size by 50%, with a more clean and readable code as result.
In my professional missions, I have wrote some java applications with many dozen of overloaded search functions. Those search functions were designed to fulfill (among others business requirements) two huge and complex business requirements, returning the result list for the user :
- accept all criteria, filters and options of the user search interface as function parameters
- apply options, execute the query(with partial filters), and finally filter the result before delivering.
In my cases, criteria, options and filters was limited in quantity. But I have also worked on the maintenance of CMS solutions, where limiting the user's criteria, options and filters capability was not a reasonable option.
In that last situation, you can imagine how complex and sometime hard to follow, were some search functions and associated helper codes.
My point here is : with lambda expressions, half of that code will go to trash, and those search functions will have a friendly look. I will not demonstrate that further in this blog, but as I am waiting to put this practice, as soon as the java 8 version will be ready.
I will share those experiences in future blogs.
I will share those experiences in future blogs.
Regards,
Aucun commentaire:
Publier un commentaire