Reading-notes

FUNCTIONAL PROGRAMMING

What is functional programming?

is a programming paradigm where programs are constructed by applying and composing functions. It is a declarative programming paradigm in which function definitions are trees of expressions that map values to other values, rather than a sequence of imperative statements which update the running state of the program.

What is a pure function and how do we know if something is a pure function?

Pure functions are essential for a variety of purposes, including functional programming, reliable concurrency, and React+Redux apps.

What are the benefits of a pure function?

The function return values are identical for identical arguments (no variation with local static variables, non-local variables, mutable reference arguments or input streams). The function application has no side effects (no mutation of local static variables, non-local variables, mutable reference arguments or input/output streams). Thus a pure function is a computational analogue of a mathematical function. Some authors, particularly from the imperative language community, use the term “pure” for all functions that just have the above property

What is immutability?

is an object whose state cannot be modified after it is created.[2] This is in contrast to a mutable object (changeable object), which can be modified after it is created. [3] In some cases, an object is considered immutable even if some internally used attributes change, but the object’s state appears unchanging from an external point of view. For example, an object that uses memoization to cache the results of expensive computations could still be considered an immutable object.

What is Referential transparency?

Referential transparency and referential opacity are properties of parts of computer programs. An expression is called referentially transparent if it can be replaced with its corresponding value (and vice-versa) without changing the program’s behavior.[1] This requires that the expression be pure, that is to say the expression value must be the same for the same inputs and its evaluation must have no side effects. An expression that is not referentially transparent is called referentially opaque.


What is a module?

A module is a software component or part of a program that contains one or more routines. One or more independently developed modules make up a program. An enterprise-level software application may contain several different modules, and each module serves unique and separate business operations.

Modules make a programmer’s job easy by allowing the programmer to focus on only one area of the functionality of the software application. Modules are typically incorporated into the program (software) through interfaces.

What does the word ‘require’ do?

How do we bring another module into the file the we are working in?

What do we have to do to make a module available?