1.

Second: 

Answer»
  • Stateful logic -  involves managing the state which changes over time. It is concerned with data that is of a different state whose state is changing EVERY time. 

Example: tracking the position of some moving object, as the time passes if something is in motion then its position is changing. so, we can say the position has a different state and a logic performing some manipulation on position is called stateful logic. 

  • Stateless logic - takes a certain input value and just RETURNS the expected result. It deals with stateless data whose value is not changing over time. We are not considering the PREVIOUS value of the data but the current one only. There are many libraries that are used in every programming language, for example date formatting. This library, WHATEVER value you passed to it, will give you a date format that is always the same. 

Generally stateless logic does not involve a RECORD of previous interactions and each and every interaction request has to be handled based on information that is new (that comes with the request). 



Discussion

No Comment Found

Related InterviewSolutions