Why Functional Programming Matters

ted@tedneward.com | Blog: http://blogs.tedneward.com | Twitter: tedneward | Github: tedneward | LinkedIn: tedneward

Concepts

What is a programming language?

Concepts

What do programming languages do for us?

Concepts

What is the abstraction principle?

Concepts

In short:

History

In the beginning, God created objects....

History

Functional programming is a different way of thinking about modularizing applications

And, admittedly at times it is a different way of thinking that runs entirely contradictory to the way that object-oriented programmers think

Functional Programming

What's it mean, exactly?

Concepts

Basic functional concepts

Concepts

Optional functional concepts

Concepts

Immutable values

Values over variables

Concepts

A functional pseudocode example


let x = 0
let y = 1
let z = x + y

Concepts

Functions as first-class values

Concepts

Higher-order functions


let numbers = [1, 2, 3, 4, 5]
let squares = numbers.map((num) -> num * num);
// squares = [1, 4, 9, 16, 25]

Concepts

Partial application

Currying

Concepts

Partial application


let add x y = x + y

let five = add 2 3  // = 5
let addBy2 = add 2  // = (anonymous fn) = 2 + y
let six = addBy2 addBy2 2 // = 6

Concepts

Function composition

Concepts

Strongly-typed

Type-inferenced

Concepts

Recursion

Concepts

Expressions-not-statements

Concepts

Tuples, lists

Concepts

Pattern-matching

Concepts

Laziness

Concepts

Sequences

Examples

Seeing it in action

Summary

Wrapping up

Summary

Abstractions

Summary

Continuations

Concurrency

Summary

Functional programming is not going to replace object-orientation

The best functional usage, then, will supplement your objects, and vice versa

Summary

Functional programming represents a new tool in your toolbox, not wholesale rejection of prior art