Java 8#3 Stateless Functions in Functional Programming | Java9s.com

preview_player
Показать описание
Functions should be stateless to avoid any uncertain changes from outside for their execution. They should not depend on any state of the objects or maintain state which can influence the result of further execution of the function. In this session i have explained how statelessness is important for functions and advantage of being stateless.
Рекомендации по теме
Комментарии
Автор

Context diverted: The function calculateCurrentValueFP also mutable in given sample.

I think, it should be as below,
return price - (totalDistance * 0.10);

ishasisters-jp
Автор

Sir can you do this with diagram. like 2 thread change value and function give advantage of stateless

parmodprajapati
Автор

thank u very much sir for the clear expalnations. i enjoy your videos. cheers ;)

yashin
Автор

calculateCurrentValueFP method is also statefull
since we are passing object state i.e. instance variables as object arguments

vivekmishra