/
Stateless vs Statefull
Stateless vs Statefull
The State of a system is the stored information that determines its current status at a certain point in time.
Stateless system
Does not store information about past interactions with the system. So, it’s like the first interaction each time.
class Return{
String interact(String input) {
return input;
}
}
Other example of stateless system : HTTP (application layer protocol in the TCP/IP model used to transfer information between devices in a network); IP or Internet Protocol (network layer in the TCP/IP model used for sending packets from source to destination).
Statefull system
Stores information about the last interaction and the system may produce different outputs than the previous interactions.
class Counter {
private int count = 0;
int count() {
count++;
return count;
}
}
, multiple selections available,