Functional Programming

Functional Programming languages focus on computations as opposed to executing a series of commands.

Functional programming (often abbreviated FP) is the process of building software by composing pure functions, avoiding shared state, mutable data, and side-effects. Functional programming is declarative rather than imperative, and application state flows through pure functions. Contrast with object oriented programming, where application state is usually shared and colocated with methods in objects.

C# is an object oriented language, but it gives us the ability to program in functional style. LINQ queries are inherently functional.

Functional Programming Guidelines:

  1. No side effects: no effects happened outside the function scope
  2. Functions are first-class citizens: functions are treated like any other type and can be passed around as objects.
  3. Functions have small scope and responsibility
  4. Use of expressions: instead of creating a variable without a value and assign its value, use an expression to assign a value as you created it.

results matching ""

    No results matching ""