We have studied about idempotent matrices. How does it apply to computer programming?
An idempotent operation can be defined as:
a. Unary: f(f(x) => f(x)
b. Binary: f(x,x) => x
So, it effectively means that an operation leaves the operand in original /known form.
Why would we need such behavior in our program?
There are various problems that need that data must not lose its integrity after any processing. e.g. A producer and consumer could have agreed on a standard data-format. The carrier layer must make sure that it transports the data, guaranteed idempotent. Carrier is free to process, inspect, play with data; but when it reaches the consumer, you got to make sure that you deliver in the agreed format. Our standard TCP/IP protocol is such an example. An application receives exactly what it expects from TCP/IP stack.