functional leap of faith (keynote at jday lviv 2014)

Post on 25-Jan-2015

299 Views

Category:

Software

3 Downloads

Preview:

Click to see full reader

DESCRIPTION

Keynote talk given at JDay Lviv 2014 in Ukraine (http://www.jday.com.ua/). Video coming soon. Abstract: Some say that there's nothing new under the sun. However, looking back on five to six decades of computing, it's easy to see that things progress at their own leisurly pace. Structured programming, originating in the '60s, did not gain mainstream adoption until the '80s; object-oriented programming was hotly debated in the '70s and '80s but only gained widespread acceptance in the '90s. Every couple of decades sees an engineering leap that radically improves the software engineering discipline across the board. I believe we are now at such an inflection point, with functional programming concepts slowly sifting into the mainstream. After this talk, I hope you will too.

TRANSCRIPT

Functional Leap of Faith

Tomer Gabel, WixJDay Lviv 2014

Through the Looking Glass

20 years ago…

• C/C++ rule the

market [1]

• First release of

Java

[1] TIOBE Index (historical data)

… since then?*

• C and Java are neck-and-neck• Virtual machines are everywhere• Garbage collection is everywhere• OOP is everywhere

* Not exhaustive

Virtual Machines

1967 BCPL

1978 UCSD p-System

1994 JVM

2014 Everywhere!

Garbage Collection

1960 Formalized[1]

1970s Research

1994 JVM

2014 Everywhere!

[1] Recursive Functions of Symbolic Expressions and Their Computation by Machine, Part I

Object-Oriented Programming

1967 Simula 67

1980 Smalltalk 80

1983 C++

2014 Everywhere!

Advances take decades to become mainstream

Market Growth[1]

1975 1980 1985 1990 1995 2000 2005 2010 2015* 2020*0

500000000

1000000000

1500000000

2000000000

2500000000

3000000000

[1] eTForecasts Worldwide PC Market Research Report

1975 1980 1985 1990 1995 2000 2005 2010 2015* 2020*0

500000000

1000000000

1500000000

2000000000

2500000000

3000000000

Market Growth

• Structured Programming

• Module Systems

• Dynamic Memory

Allocation

1975 1980 1985 1990 1995 2000 2005 2010 2015* 2020*0

500000000

1000000000

1500000000

2000000000

2500000000

3000000000

Market Growth

• Garbage Collection

• OOP

• VMs and JIT

1975 1980 1985 1990 1995 2000 2005 2010 2015* 2020*0

500000000

1000000000

1500000000

2000000000

2500000000

3000000000

Market Growth

You are here!

What’s holding us back?

The Market has Shifted

• SaaS is the norm

• Shorter time to market

• Latency requirements are stricter

• Availability is business-critical

The Free Lunch is Over[1]

[1] The Free Lunch is Over, Herb Stutter (Dr. Dobb's Journal, 2005)

• CPUs aren’t getting (much) faster

• Rather, they’re getting parallel

• Concurrency is the new kid on the block

Datasets are Getting Bigger

• Terabyte-scale data is common

• Computation demand – NoSQL– Big Data

• Specialized hardware (SAN) is a hindrance

We need new abstractions.

Three desirable attributes:

Today’s systems

are highly available & reliable.

Tomorrow’s abstraction must…

encourage correct code.

Complexity is the Mind Killer

• Complex system bigger

codebase

• More code more bugs

• We want less code

• We want correct code

Control flow Data flow

We need to invert our thinking.

How What

We need to invert our thinking.

Control flow describes the how

List<Person> adults(List<Person> in) {

ArrayList<Person> out = new ArrayList<>();

for (Person p : in) if (p.getAge() >= 18) out.add(p);

return out;}

Data flow describes the what

List<Person> adults(List<Person> in) { return in.stream() .filter(p -> p.age >= 18) .collect(Collectors.toList());}

“What” is Better

• Focuses on the problem

• Reduces accidental complexity

• Decouples intent from execution

I WANT YOU

TO STOPWORRYING

ABOUT TRIVIA

Today’s systems

are highly concurrent.

Tomorrow’s abstraction must…

encourage immutability.

The Case for Immutability

• Inherently thread-safe

• Referentially transparent

• Easier to reason about!

Today’s systems

are horizontally scalable.

Tomorrow’s abstraction must…

simplify workload distribution.

Distribution 101

1. Take a core computation

2. Split it out

3. Run on many nodes

4. Profit

Why is this hard?

• Behavior-as-data

• Side effects

• High-performance

frameworks

Lambdas

Immutability

Akka, Hadoop,

Storm…

The future is functional.

1. Data flow-oriented

2. Immutable3. Easy to

distribute

top related