Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
1 1
So we talked about problem solving, 2
2
which is a very important skill of any software developer. 3
3
Now, another extremely important 4
4
developer skill is debugging, 5
5
which means to find and fix errors. 6
6
So let's finish this section by talking about debugging 7
7
to make you ready for the rest of the course ahead. 8
8
So first of all, as you might already know, 9
9
a software bug is a defect or a problem 10
10
in a computer program. 11
11
So basically, any unexpected or unintended behavior 12
12
of a program is called a bug. 13
13
And the actual term bug was coined in the 1940s 14
14
when this real bug was causing an error 15
15
in Harvard's computer. 16
16
Now, there are many reasons for bugs in programs, 17
17
but what matters here is that bugs 18
18
are a completely normal part of software development, 19
19
because we are humans, 20
20
and humans make mistakes. 21
21
In fact, every complex application contains bugs, 22
22
which sometimes go undiscovered for years 23
23
and can cause security holes or other problems. 24
24
So really, don't feel bad if you introduce bugs 25
25
in your own count. 26
26
We all do it, even the most expert programmers. 27
27
Now luckily, not all bugs cause huge security holes. 28
28
In fact, many bugs are quite small 29
29
and simple to discover. 30
30
So let's see a simple example. 31
31
Remember in our previous example, 32
32
the goal was to reverse whatever was passed 33
33
into the function. 34
34
So let's say we finished writing the reverse function, 35
35
and call it with this array and get this result. 36
36
But clearly something is wrong here, right? 37
37
The return value looks scrambled, 38
38
but not reversed at all. 39
39
So this means that we must have a bug somewhere 40
40
in our reverse function, okay? 41
41
To fix this, we use a process called debugging, 42
42
which is essentially finding, fixing, 43
43
and then preventing bugs. 44
44
So let's see how that works. 45
45
So the first step is to actually become aware 46
46
that there is some kind of bug, 47
47
because as I said, in a large application, 48
48
bugs can actually go undiscovered for years. 49
49
Now, discovering bugs usually happens 50
50
during development using automated testing software 51
51
or user reports during production. 52
52
And bugs that are identified during production 53
53
are the worst bugs, 54
54
because it means that they went undiscovered 55
55
during development and are now affecting 56
56
real users of our application. 57
57
So that's why it's really important 58
58
to identify bugs early, 59
59
for example, using automated tests. 60
60
Now, while identifying the bug, 61
61
sometimes we also need to take into consideration 62
62
the context in which the bug happened. 63
63
For example, certain bugs might only happen 64
64
in a certain browser, 65
65
or only for certain users, for some reason. 66
66
Next, once we know there is a bug, 67
67
we need to go into our code and find the bug. 68
68
We need to isolate where exactly it's happening, 69
69
and we can do that using the developer console 70
70
that we already know. 71
71
However, that only works for small bugs 72
72
and simple code where we have a good idea 73
73
where the bug might be located. 74
74
But if the code is more complex 75
75
and we have no idea where the bug might be, 76
76
then we need to use a debugger software. 77
77
And I will show you how that works in the next video 78
78
because it's really important for developer 79
79
to be able to use a debugger. 80
80
Anyway, once we know where the bug is located, 81
81
we can finally fix it so we can correct the bug. 82
82
And this is probably the easiest part. 83
83
So essentially, all we need to do 84
84
is to replace the existing, so the wrong solution, 85
85
with a new correct solution that actually works. 86
86
As a final step, we should then prevent this bug 87
87
from ever happening again in our code base. 88
88
For example, we can search our project 89
89
for the same bug in similar code, 90
90
like in a similar function. 91
91
It's totally possible that we did the same mistake 92
92
twice in our code, 93
93
and if that's the case, 94
94
we must fix the bug everywhere. 95
95
A more advanced way of preventing bugs 96
96
is to write tests using testing software. 97
97
And I might add a bonus section on testing 98
98
to the course at some point 99
99
because this is actually an important part 100
100
of software development. 101
101
Okay, and that's it. 102
102
That's a broad overview of debugging in programming. 103
103
And we really just scratched the surface here, 104
104
because you're still at the beginning of the journey. 105
105
And so this is just an introduction. 106
106
Anyway, let's now fix some bugs in the next video.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.