tammersaleh / tammersaleh.com

My homepage
http://tammersaleh.com
MIT License
72 stars 41 forks source link

The most important concepts behind cloud development #46

Open tammersaleh opened 10 years ago

tammersaleh commented 10 years ago

And how they are related.

tammersaleh commented 10 years ago

Idempotence

Idempotence (/ˌaɪdɨmˈpoʊtəns/ eye-dəm-poh-təns) is the property of certain operations in mathematics and computer science, that can be applied multiple times without changing the result beyond the initial application. The concept of idempotence arises in a number of places in abstract algebra (in particular, in the theory of projectors and closure operators) and functional programming (in which it is connected to the property of referential transparency).

The term was introduced by Benjamin Peirce[1] in the context of elements of algebras that remain invariant when raised to a positive integer power, and literally means "(the quality of having) the same power", from idem + potence (same + power).

There are several meanings of idempotence, depending on what the concept is applied to:

  • A unary operation (or function) is idempotent if, whenever it is applied twice to any value, it gives the same result as if it were applied once; i.e., ƒ(ƒ(x)) ≡ ƒ(x). For example, the absolute value: abs(abs(x)) ≡ abs(x).
  • A binary operation is idempotent if, whenever it is applied to two equal values, it gives that value as the result. For example, the operation giving the maximum value of two values is idempotent: max (x, x) ≡ x.
  • Given a binary operation, an idempotent element (or simply an idempotent) for the operation is a value for which the operation, when given that value for both of its operands, gives the value as the result. For example, the number 1 is an idempotent of multiplication: 1 × 1 = 1.

I can call Foo() twice and be confident that I will get the same result. Foo() has no side effects.

tammersaleh commented 10 years ago

reentrant

In computing, a computer program or subroutine is called reentrant if it can be interrupted in the middle of its execution and then safely called again ("re-entered") before its previous invocations complete execution. The interruption could be caused by an internal action such as a jump or call, or by an external action such as a hardware interrupt or signal. Once the reentered invocation completes, the previous invocations will resume correct execution.

I can call Foo() and call it again before it finishes. I can also call Foo(), and pause it, call another Foo(), and restart the first Foo() without worry.

tammersaleh commented 10 years ago

convergence is a term stolen from networking configuration management:

Convergence is the state of a set of routers that have the same topological information about the internetwork in which they operate. For a set of routers to have converged, they must have collected all available topology information from each other via the implemented routing protocol, the information they gathered must not contradict any other router's topology information in the set, and it must reflect the real state of the network. In other words: In a converged network all routers "agree" on what the network topology looks like.

If a system gets out of wack, I can return it to the expected state by running Foo(). This implies that Foo() is idempotent. Such a system has the concept of the delta between the actual and desired state, though it doesn't actually need to know the actual state.

tammersaleh commented 10 years ago

Convergence implies idempotence.

Reentrance facilitates convergence and idempotence in multi-actor environment.