WEBVTT

0
00:00.140 --> 00:05.850
Hi everyone in this video I'm going to highlight a about why Java8 important and why the Java

1
00:05.880 --> 00:11.530
developers should invest in learning all the features that got introduced as part of Java8.

2
00:11.970 --> 00:17.580
We all know that Java is one of the most popular and widely accepted language in the world. Since it's

3
00:17.670 --> 00:19.790
already one of the mostly used language.

4
00:19.800 --> 00:26.910
Why the Java creators decided to change it. Java creators decided they wanted to introduce the functional

5
00:26.910 --> 00:34.590
features such as Lambdas, Streams, Optionals and etc because of the technology advancements that are happening

6
00:34.620 --> 00:35.880
around the world.

7
00:35.880 --> 00:41.670
Even a smart mobile in our hands have multiple processors in order to make use of the multiple

8
00:41.670 --> 00:45.520
processors prior to  Java 8 you have to use threads.

9
00:45.560 --> 00:51.450
Otherwise you will just be accessing only one processor even though the system that you with you

10
00:51.660 --> 00:57.870
have multiple processors and we all know that working with threads is so touchy and you have to be

11
00:57.870 --> 00:59.620
really really careful working with Threads.

12
00:59.620 --> 01:07.470
With Java8 we will be able to write the functional programming code using the new functional concepts

13
01:07.740 --> 01:14.610
which is going to help you simplify the concurrency operations which will make use of the multiple processors

14
01:14.970 --> 01:18.250
whenever you perform the concurrency operations.

15
01:18.380 --> 01:25.030
We will be covering a lot of examples on this topic in the course. Now,  we'll talk about what are the other

16
01:25.030 --> 01:28.540
capabilities that functional programming can help you achieve.

17
01:28.660 --> 01:36.030
It supports creating immutable objects which is going to solve a lot of problems in the java application.

18
01:36.070 --> 01:43.360
If you think about it mutable objects are the source for many errors in java application and functional programming

19
01:43.650 --> 01:51.690
highly discourages mutating an object and functional programming is going to let you write more concise

20
01:51.780 --> 01:55.560
and readable code. With Java8

21
01:55.580 --> 02:01.040
it is going to let you use the functions or methods as first class citizens.

22
02:01.160 --> 02:08.930
What does it mean is that functional programming is going to let you create a function and assign that functionality

23
02:08.960 --> 02:13.580
to a variable and pass it around as like method parameters.

24
02:13.580 --> 02:16.000
This was never possible before Java 8.

25
02:16.040 --> 02:18.650
This is an excellent addition to Java8.

26
02:18.980 --> 02:21.700
Here is a simple example that I have here.

27
02:21.950 --> 02:26.930
This whole line might look new to you because function is something which got introduced as part of

28
02:26.930 --> 02:27.980
Java8.

29
02:28.040 --> 02:32.960
This represents the input and this represents the output and we have a new syntax here.

30
02:32.960 --> 02:35.110
This syntax is called lambda syntax.

31
02:35.270 --> 02:40.380
You don't have to worry about it for now because I'll be walking you through all these concepts step

32
02:40.400 --> 02:44.030
by step and we're going to cover all these concepts via code.

33
02:44.040 --> 02:48.700
Don't worry about it for now. Let me explain what's happening here.

34
02:48.770 --> 02:54.110
So here the input is going to be a string and then we are performing the uppercase operation on it and

35
02:54.110 --> 02:58.790
then followed by that we are performing the concatenation operation here.

36
02:58.880 --> 03:05.360
Basically two operations are happening and this logic is being assigned to a variable called add some

37
03:05.360 --> 03:10.430
string and we can pass this add some string as like any other variable in Java.

38
03:10.490 --> 03:18.050
That's one of the benefits of functional programming. With Java8 it is going to let you write the code

39
03:18.140 --> 03:24.170
in a declarative way rather than an imperative way. What does it mean?  I'm going to highlight the difference

40
03:24.170 --> 03:28.180
between imperative and declarative style of programming.

41
03:28.250 --> 03:30.870
Let's talk about the imperative style of programming.

42
03:32.310 --> 03:37.200
This style of programming focuses on how to get the result that we want.

43
03:37.440 --> 03:43.860
This style of programming embrace's changing the object's state to achieve an objective which is nothing

44
03:43.860 --> 03:50.340
but mutating an object and getting that result you want. Lets say you want to achieve an objective then

45
03:50.370 --> 03:54.100
you define the list of steps to achieve an objective.

46
03:54.300 --> 03:58.140
You code what needs to be done in each step.

47
03:58.170 --> 04:04.790
Imperative programming is a concept used behind the classic object oriented programming style.

48
04:05.070 --> 04:07.770
Now let's talk about that declarative programming.

49
04:08.850 --> 04:12.630
This style of programming focuses on what is the result you want.

50
04:12.660 --> 04:16.500
It does not bother or worry about how to get the result.

51
04:16.590 --> 04:23.990
This style of programming embraces object immutability. This style of programming is analogous to SQL.

52
04:24.260 --> 04:24.980
In SQL, 

53
04:24.990 --> 04:29.330
we request for data from the tables but we don't care about what is 

54
04:29.380 --> 04:33.820
algorithm or how the data is retrieved from the DB. Right ?

55
04:33.950 --> 04:41.180
Declarative style of programming is similar to the same concept. We will make use of the 

56
04:41.180 --> 04:43.400
functions that comes with the language.

57
04:43.490 --> 04:45.160
So far Java 8, 

58
04:45.290 --> 04:48.570
there are lot of functions that got introduced as part of it.

59
04:48.630 --> 04:53.260
You're going to make use of those functions in order to get the result we want.

60
04:53.270 --> 04:58.550
You don't have to worry about how the data is processed behind the scenes in order to get the result

61
04:58.550 --> 04:59.570
you want.

62
04:59.570 --> 05:06.350
Functional programming uses a concept of declarative programming. I would like to explain the difference between

63
05:06.350 --> 05:10.070
the imperative style and declarative style using some examples.

64
05:10.100 --> 05:11.970
We'll code this in the following tutorials.

65
05:12.190 --> 05:14.320
With we came to the end of the theory part.

66
05:14.510 --> 05:15.480
Thank you for watching.