This course will be retired on June 1, 2025.
Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Preview
Start a free Courses trial
to watch this video
Functional programming is catching on like wild fire.
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
In order to answer,
why is functional programming so
0:00
hot right now,
let's take a quick jog through history.
0:03
Let's start our journey
way back in the 1930s and
0:07
take a look at some work that was going
on that would lay the ground work
0:10
to help define programming
as we know it today.
0:13
An investigation into the foundation
of mathematics was going on.
0:17
This study led to the creation of
a formal system named lambda calculus.
0:21
Here's where the functions I was talking
about come into play pretty heavily.
0:25
You've probably seen them.
0:29
They're written like this, that swervy f.
0:30
This study made for some formal rules
that were manually tested for decades.
0:33
And eventually it was decided to
attempt to prove them using a computer.
0:38
Now we're talking about the 50s.
0:43
If you'll remember, this is a time
when computers were ginormous, and
0:44
the amount of memory and
processing power available was minuscule.
0:48
The technology just wasn't there.
0:53
Several languages spawned
from these early days.
0:54
And these languages were not only used for
mathematical proofing, but also for
0:57
early attempts at artificial intelligence.
1:01
These proven mathematical rules made it
possible to express very complex ideas.
1:05
However, the rules were not always
easy to implement in an efficient way.
1:10
Especially with the limited
resources available.
1:15
Let's take a peek at one of these
rules that we'll cover in great
1:18
detail throughout the course.
1:21
One of the main tenants of functional
programming is that a function is pure.
1:23
That means that a function when
called with the same arguments must
1:27
always return the same result,
no matter what.
1:31
Enforcing the pure function rule
arguably made things difficult to
1:34
make efficient with
the computers at that time.
1:38
So, to deal with the efficiency challenge,
a programming paradigm
1:41
based on how to efficiently communicate
with the computer at a low level with spawn.
1:46
This style of programming
is called Imperative.
1:51
It focuses specifically on the how
to perform the operations.
1:54
Efficiency is controlled by storing State,
1:58
it deals with conditional branching and
looping.
2:01
The order of execution matters.
2:04
Over time, sub processes for
2:06
grouping statements together began to
appear to make things more readable.
2:08
These are the starts of what we
will eventually know as methods.
2:13
And they are not pure,
since state is stored and manipulated.
2:16
In the 80s and onward we saw a huge
growth in imperative programming,
2:21
object oriented programming was born and
very much embraced.
2:26
OOP allows us to make our code more
understandable through encapsulation.
2:30
It minimizes the moving
parts of the application.
2:35
As programming languages evolved,
so did our hardware.
2:38
And you can now buy a USB key chain that
2:42
has more space then the most expensive
machinery in the early days.
2:45
And not only do we have more memory,
we have more computers.
2:50
The cloud has given us seemingly boundless
access to the computer power that we need.
2:54
Our problems are more complex and
our data is bigger and
2:59
more readily available and
critical to our applications.
3:03
As we've shifted focus on dealing
with these larger problems,
3:06
we've discovered that if we share the work
across our many computers on the cloud,
3:10
or even across multiple processors cores,
that we can take on just about any task.
3:15
The problem, though, now,
almost ironically, is state.
3:21
Whomp whomp.
3:25
Once a program requires state to make
it work correctly, the synchronization
3:27
amongst running programs is quite
difficult to do efficiently,
3:32
if not impossible.
3:36
So things are starting
to come full circle.
3:37
[SOUND] Functional programming is rearing
its head because it can be easily run in
3:40
our new environment as
the functions are pure, and
3:45
you can split your program across
many environments almost seamlessly.
3:48
All imperative languages that I can think
of have started to have more functional
3:53
capabilities and
Java [SOUND] has joined the game.
3:58
The simple explanation, and the one that
you'll hear is that functional programming
4:00
deals with functions, and
object oriented programming deals objects.
4:05
Java is now a hybrid.
4:09
So now that Java has
the ability to perform many
4:12
functional programming concepts,
it is really catching on.
4:15
It's slick, and
I think you're gonna love it.
4:18
It's important to learn because
technology is heading that way.
4:20
And more and more functional code is
starting to show up on the scene.
4:23
Functional programming is starting beat
the defacto way to solve large problems.
4:28
Its acceptance is growing at
a rapid pace in all languages.
4:33
Which brings me to the great news,
the concepts that you learn here will
4:36
definitely translate to other languages
that provide functional equivalence.
4:40
That reminds me, I am going to
add pure here to the parking lot.
4:46
We'll explore that concept
more here in a bit.
4:51
Are you ready to get started?
4:53
I know I am.
4:55
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up