Here are my notes on Rob Harrop's presentation about functional programming.
Functional is important because
1) Simplicity- it's declarative
- you write what you want to achieve, rather than give instructions how to achieve it
- express solutions, 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)
Imperative:
- focus on decisions (instructions), and state change
- mutable state
Functional:
- recursion not looping
- descriptions (of solutions), not statements
Functional features
- higher-order functions
- pure functions (same args in always lead to same results)
- recursion
- type systems (Haskell: strong typing; Erlang, LISP: loosely typed)
- strict/lazy evaluation
DDD: 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
- 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




