Is the Future Functional? by Rob Harrop

Here are my notes on Rob Harrop’s presentation about functional programming.

Rob Harrop

Why is Functional Important?

1. Simplicity

  • it’s declarative
  • you write what you want to achieve, rather than give instructions how to achieve it
  • express solutions, and you do not worry about individual steps

2. Agility

  • functional fits well with Agile methodology
  • testing is much easier (because of purity, no side-effects)

3. Contentment

  • self-content while you are working

4. Concurrency

  • e.g. parallelization
  • often the reason why people switch to functional

 

Imperative vs Functional Languages

Functional

  • function application (calculations to data), not state change
  • immutable state (makes testing easier)
  • recursion not looping
  • descriptions (of solutions), not statements

Imperative

  • focus on decisions (instructions), and state change
  • mutable state

Functional Features

  • higher-order functions
  • pure functions (the same args in will always lead to the same results)
  • recursion
  • type systems (Haskell: strong typing; Erlang, LISP: loosely typed)
  • strict/lazy evaluation


DDD

The primary focus should be on the domain and domain logic.

DDD Concepts

  • ubiquitous language
  • strategic design (identify which bits are harder to model and put time on it)
  • models
  • context

Domain-driven with imperative programming leads to anxiety. Always wondering if you got your model right, because there are a myriad of ways to implement a solution.

Functional DDD

  • the core concepts still apply
  • everything is just a function or data structure

 

Why is Functional Better?

  • fewer concepts (no factories, no patterns)
  • easier concepts
  • lower model overhead

Modelling

  • UML doesn’t really work for functional
  • fortunately, we all know how to model in functional languages
Advertisements

Got a comment?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: