This page (revision-1) was last changed on 29-Nov-2024 16:16 by UnknownAuthor

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Page revision history

Version Date Modified Size Author Changes ... Change note

Page References

Incoming links Outgoing links

Version management

Difference between version and

At line 1 added 39 lines
!!! Overview
[{$pagename}] is a [programming] [Architecture] that treats computation as the evaluation of mathematical [functions] and avoids changing-[state] and [mutable|Mutability] [data].
[{$pagename}] has no reliance on [data] outside the current [function] __and__ there is no change to [data] that exists outside the current [function]
This is [{$pagename}]:
%%prettify
{{{
def increment(a):
return a + 1
}}} /%
This is __NOT__ [{$pagename}]:
%%prettify
{{{
a = 0
def increment():
global a
a += 1
}}} /%
[{$pagename}] has its origins in lambda calculus, a formal system developed in the [1930s] to investigate computability, the Entscheidungsproblem, function definition, function application, and recursion. Many functional programming languages can be viewed as elaborations on the lambda calculus.[2]
!! [idempotent] (ie [Immutable])
[{$pagename}] operations (or service call) should be [idempotent], implying that [clients] can make that same call repeatedly while producing the same result. In other words, making multiple identical requests has the same effect as making a single request. Note that while [idempotent] operations produce the same result on the server (no side effects), the response itself may not be the same (e.g. a resource's [state] may change between requests).
There are also some __caveats__ to remember. (Although we show [HTTP Request], this is applicable to many other [Protocols])
The [HTTP PUT] and [HTTP DELETE] methods are defined to be [idempotent]. However, there is a caveat on [HTTP DELETE] which if successful would normally return a [HTTP 200] (OK) or [HTTP 204] (No Content), will often return a [HTTP 404] (Not Found) on subsequent calls, unless the service is configured to "mark" resources for deletion without actually deleting them. However, when the service actually deletes the resource, the next [HTTP DELETE] will not find the resource to delete it and return a 404. However, the [state] on the server is the same after each [HTTP DELETE] call, but the response is different.
[HTTP GET], [HTTP HEAD], [HTTP OPTIONS] and [HTTP TRACE] methods are only intended for retrieving [data] which makes them [idempotent] as well since multiple, identical requests will behave the same. (Again assuming the [state] of the resource is the same)
!! More Information
There might be more information for this subject on one of the following:
[{ReferringPagesPlugin before='*' after='\n' }]
----
* [#1] - [A practical introduction to functional programming|https://maryrosecook.com/blog/post/a-practical-introduction-to-functional-programming|target='_blank'] - based on information obtained 2017-04-30-
* [#2] - [Functional_programming|Wikipedia:Functional_programming|target='_blank'] - based on information obtained 2017-04-30-