WEBVTT

1
00:00:00.000 --> 00:00:04.880
Hi everyone, welcome back. In this lecture we are going to be writing a similar functionality

2
00:00:04.880 --> 00:00:09.760
but we are going to be exploring the coding assistant which is our github copilot that we

3
00:00:09.760 --> 00:00:16.879
have installed and we are going to use the coding assistant to write the similar code for us because

4
00:00:16.879 --> 00:00:22.799
the coding assistants are on the rise and all the organizations today are recommending the developers

5
00:00:22.799 --> 00:00:29.120
to start leveraging these tools to improve the productivity and also using these tools the right

6
00:00:29.120 --> 00:00:36.159
way will benefit you in many ways and using the wrong way is not going to benefit you in many ways

7
00:00:36.159 --> 00:00:41.119
so in this course i'll walk you through what are the ways that we can use these tools in the

8
00:00:41.119 --> 00:00:46.880
correct way that can benefit the developers i don't have the whole course updated with the

9
00:00:46.880 --> 00:00:53.119
github copilot assistant but whatever new lectures all the java 25 features that we are going to

10
00:00:53.119 --> 00:00:59.200
explore we are going to leverage the copilot assistant now what i'm going to do is there are

11
00:00:59.200 --> 00:01:03.759
different modes available here so number one is the ask mode number two is the agent mode number

12
00:01:03.759 --> 00:01:09.120
three is a edit mode ask mode is something which you can chat and interact with like how you can

13
00:01:09.120 --> 00:01:15.519
do it with chat cpt so now what i'm going to do is i'm going to ask can you write a simple java

14
00:01:15.519 --> 00:01:23.680
program using the compact main functionality that's introduced in java 25 okay so then i'm

15
00:01:23.680 --> 00:01:29.440
going to press enter so this is not going to edit the source code files this is going to just give

16
00:01:29.440 --> 00:01:34.959
you the program for you so that you can take this program and then put this in your class file as

17
00:01:34.959 --> 00:01:40.720
you can see so here is a simple java program using the compact main functionality introduced in java

18
00:01:40.720 --> 00:01:46.080
25 and you can see that it gave me this code whatever we wrote right so it took us like

19
00:01:46.080 --> 00:01:51.279
probably uh three to five minutes to write this code and explain the code but here you go you have

20
00:01:51.279 --> 00:01:57.680
the code readily available within a few seconds so this is the beauty of these copilot ai coding

21
00:01:57.680 --> 00:02:03.040
assistant tools but one thing we need to make sure is that we need to ask the right question so that

22
00:02:03.040 --> 00:02:09.440
you will get the right answer and the model that i'm using is that clarkson at 4.5 and what i did

23
00:02:09.440 --> 00:02:16.800
was i went ahead and subscribed for the github copilot pro license which is 10 dollars per month

24
00:02:16.800 --> 00:02:22.639
that's the reason why i have access to all these models i'm using the clarkson at 4.5 this is the

25
00:02:22.639 --> 00:02:27.679
latest and greatest model at the time of recording this lecture if you're using a free tier you might

26
00:02:27.679 --> 00:02:33.759
be having access to 3.5 or something like that or the 4.1 version so use the latest model that's

27
00:02:33.759 --> 00:02:39.119
available to you but using the premium models is what is going to give you the right code because

28
00:02:39.119 --> 00:02:44.639
java 25 is one of the latest feature if you use the older model it might not have knowledge about

29
00:02:44.639 --> 00:02:51.600
the java 25 features at all so it's better to use the latest and greatest model so this is the ask

30
00:02:51.600 --> 00:02:56.160
mode so what i'm going to do is i'm going to look into the edit mode so in the edit mode what i'm

31
00:02:56.160 --> 00:03:02.479
going to do let me copy the prompt over here copy it over here and then click on the edit mode i'm

32
00:03:02.479 --> 00:03:11.279
going to ask can you introduce a variable named course and then print it in the console okay and

33
00:03:11.279 --> 00:03:16.720
then you need to add the files where you want to edit to happen so select the simple hello hold

34
00:03:16.720 --> 00:03:21.600
there you go we have the simple hello world selected and then send when you do this what

35
00:03:21.600 --> 00:03:27.360
this is going to do is this is going to go ahead and edit the file for you as you can see it added

36
00:03:27.360 --> 00:03:33.440
the course name as modern java and then printed that value in the console so now it has this

37
00:03:33.440 --> 00:03:39.279
changes being made as a user of the coding assistant we are the developers we need to

38
00:03:39.279 --> 00:03:44.960
accept this change or discard this change when you accept this change this is going to be basically

39
00:03:44.960 --> 00:03:50.479
making the code available in the class if you discard the change then it will automatically

40
00:03:50.479 --> 00:03:55.199
remove the change now i'm going to execute this particular class and as you can see the class is

41
00:03:55.199 --> 00:04:03.440
getting executed there you go so we have the course value as modern java now let's take a look

42
00:04:03.440 --> 00:04:09.679
at the agent mode agent mode is something which is an advanced mode which can go ahead and create the

43
00:04:09.679 --> 00:04:16.079
class for you which can also create the functions variables whatnot whatever you ask it to do

44
00:04:16.079 --> 00:04:21.760
it will actually do it for you but you need to be really clear about what you want the agent to do

45
00:04:21.760 --> 00:04:27.600
otherwise it will try to do something which you do not expect it to do so what i'm going to do is

46
00:04:27.600 --> 00:04:32.239
i'm going to copy the same thing over here and place it over here so i'm going to be telling

47
00:04:32.239 --> 00:04:36.880
that create a simple java program using the compact main and make sure you have the latest

48
00:04:36.880 --> 00:04:43.279
model here i'm selecting the clotson at 4.5 and here i'm going to ask it to do the new class name

49
00:04:43.279 --> 00:04:50.640
should be simple hello world one or i can say v1 okay so you need to be explicit about what you want

50
00:04:50.640 --> 00:04:56.239
the agent to do otherwise it will do some random things which is not expected so i'm going to press

51
00:04:56.239 --> 00:05:06.399
enter okay so it created a class named simple hello world v1 right so it is actually over here

52
00:05:06.399 --> 00:05:11.600
and you can see that it added bunch of things over here right so you didn't ask it to do it but still

53
00:05:11.600 --> 00:05:17.119
it went ahead and added all these different things so now i'm going to accept it all and then show

54
00:05:17.119 --> 00:05:22.000
you what it means so it basically took some of the examples that we did in the simple hello world

55
00:05:22.000 --> 00:05:28.559
class and also it added what is the benefit of the compact main feature so it has the no class

56
00:05:28.559 --> 00:05:34.239
declaration needed no public static modifiers required and simplified io dot main method

57
00:05:34.239 --> 00:05:40.559
and top level instance variables are allowed it also showed the traditional system dot out dot

58
00:05:40.559 --> 00:05:46.320
printer and syntax and also it created the function for you so basically we didn't ask it to do all

59
00:05:46.320 --> 00:05:51.920
of these things but it did went ahead and made those changes so now we can actually ask it hey

60
00:05:51.920 --> 00:06:01.040
it looks like you made more changes than what i expected can you just have the first four lines

61
00:06:01.040 --> 00:06:06.880
of println okay and then you can tell it to remove all the other code and then press enter so you can

62
00:06:06.880 --> 00:06:12.160
see that the simple hello world v1 is the one which is being referenced now it went ahead and

63
00:06:12.160 --> 00:06:18.160
removed all the changes for you okay so you can see that it edited the file perfect i have

64
00:06:18.160 --> 00:06:23.600
simplified the code it says that now it just has the three instance variable at the top and the

65
00:06:23.600 --> 00:06:29.519
main function with only the first four println statements now we accept this change and you do

66
00:06:29.519 --> 00:06:36.239
the accept all there you go you have the simplified compact main function readily available the code

67
00:06:36.239 --> 00:06:42.320
is completely written by the copilot assistant so this is one of the benefit of using these

68
00:06:42.320 --> 00:06:48.720
a assistant tools what it can do is that it can help you learn the new features faster and you

69
00:06:48.720 --> 00:06:55.279
don't have to write the code the basic code from scratch you can use the assistant to write for you

70
00:06:55.279 --> 00:07:00.799
another thing is that you can actually highlight the code and ask and interact with the assistant

71
00:07:00.799 --> 00:07:05.279
directly from the code itself so you can actually select this you can say like what is the benefit

72
00:07:05.279 --> 00:07:15.760
of using this over system.out.println it will also give you thoughts of why using io.println

73
00:07:15.760 --> 00:07:21.359
instead of system.out.println can provide benefits such as abstraction easier testing and flexibility

74
00:07:21.359 --> 00:07:26.799
and also using different models will give you different answer but using the latest model

75
00:07:26.799 --> 00:07:31.519
always gives you the best answer as far as i can think of because the newer models are

76
00:07:31.519 --> 00:07:36.720
continuously better in reasoning they are really better in latest and greatest training data so i'm

77
00:07:36.720 --> 00:07:45.279
going to ask the same question what is the benefit of io.println over system.out.println

78
00:07:45.279 --> 00:07:51.119
so you see that right using io.println over system.out.println provides several benefits

79
00:07:51.119 --> 00:07:57.440
cleaner syntax simplified imports consistency with modern java to also talk about the simplified java

80
00:07:57.440 --> 00:08:03.279
features designed to reduce ceremony of simple programs testing flexibility feature proof so this

81
00:08:03.279 --> 00:08:09.040
model gave me the right answer when i used a 4.1 it gave an answer but it is not a great answer

82
00:08:09.040 --> 00:08:13.920
so this is also another feature when you install this copilot assistant you can directly highlight

83
00:08:13.920 --> 00:08:19.760
the code and you can ask it to explain what that code is it will be able to provide you a answer

84
00:08:19.760 --> 00:08:23.600
and you can actually read through it and get an understanding on it with this we came to the end

85
00:08:23.600 --> 00:08:29.679
of this lecture i hope you all had fun coding the compact main functionality completely using the

86
00:08:29.679 --> 00:08:35.280
copilot assistant these copilot assistants are going to stay and this is going to be the feature

87
00:08:35.280 --> 00:08:39.760
which all the organizations are going to push the developers to get comfortable with

88
00:08:39.760 --> 00:08:44.000
if you're not going to be comfortable using these tools i'm really sorry to say that you'll be left

89
00:08:44.000 --> 00:08:50.799
out and the companies will continuously going to enforce this tools to be used in your day-to-day

90
00:08:50.799 --> 00:08:54.559
development this marks the end of this lecture thank you for watching

