filmov
tv
What did functional programming ever do for us (software engineers)? A tutorial with code in Scala
Показать описание
What are the advantages of functional programming for practical work in software engineering? Why are functional programming features being added to many programming languages today, and what exactly are these features?
The exact meaning of "functional programming" is debatable. I adopt an extreme pragmatic and un-academic approach and ask the question from a software engineer's point of view: what specific advantages does FP provide? I focus not on the theoretical advantages that help computer scientists publish more papers, but on practical features that drive the industry adoption of FP by helping programmers write better code. I describe four main FP idioms that pervade the industrial FP usage today: loop-free iteration, type parameters, disjunctive types, and effect chaining. Programmers who master these features and idioms will become more productive in any language.
There are four main features (or idioms) that define what "functional programming" means in today's practice of software engineering:
1) loop-free iteration (programming in "map/filter/reduce" style)
2) ability to write code with type parameters
3) user-defined disjunctive types (also known as "tagged unions", "variant types", "sum types") and pattern matching
4) special syntax for chains of effectful computations, known as "for/yield" blocks in Scala, "do notation" in Haskell, and "computation expressions" in F#
I give examples illustrating why these idioms give decisive advantages to programmers in any language. I also indicate what features of the programming language are necessary to support these idioms of functional programming.
Slides:
The exact meaning of "functional programming" is debatable. I adopt an extreme pragmatic and un-academic approach and ask the question from a software engineer's point of view: what specific advantages does FP provide? I focus not on the theoretical advantages that help computer scientists publish more papers, but on practical features that drive the industry adoption of FP by helping programmers write better code. I describe four main FP idioms that pervade the industrial FP usage today: loop-free iteration, type parameters, disjunctive types, and effect chaining. Programmers who master these features and idioms will become more productive in any language.
There are four main features (or idioms) that define what "functional programming" means in today's practice of software engineering:
1) loop-free iteration (programming in "map/filter/reduce" style)
2) ability to write code with type parameters
3) user-defined disjunctive types (also known as "tagged unions", "variant types", "sum types") and pattern matching
4) special syntax for chains of effectful computations, known as "for/yield" blocks in Scala, "do notation" in Haskell, and "computation expressions" in F#
I give examples illustrating why these idioms give decisive advantages to programmers in any language. I also indicate what features of the programming language are necessary to support these idioms of functional programming.
Slides:
Комментарии