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
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
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
Persian
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
So we talked about problem solving,
which is a very important skill of any software developer.
Now, another extremely important
developer skill is debugging,
which means to find and fix errors.
So let's finish this section by talking about debugging
to make you ready for the rest of the course ahead.
So first of all, as you might already know,
a software bug is a defect or a problem
in a computer program.
So basically, any unexpected or unintended behavior
of a program is called a bug.
And the actual term bug was coined in the 1940s
when this real bug was causing an error
in Harvard's computer.
Now, there are many reasons for bugs in programs,
but what matters here is that bugs
are a completely normal part of software development,
because we are humans,
and humans make mistakes.
In fact, every complex application contains bugs,
which sometimes go undiscovered for years
and can cause security holes or other problems.
So really, don't feel bad if you introduce bugs
in your own count.
We all do it, even the most expert programmers.
Now luckily, not all bugs cause huge security holes.
In fact, many bugs are quite small
and simple to discover.
So let's see a simple example.
Remember in our previous example,
the goal was to reverse whatever was passed
into the function.
So let's say we finished writing the reverse function,
and call it with this array and get this result.
But clearly something is wrong here, right?
The return value looks scrambled,
but not reversed at all.
So this means that we must have a bug somewhere
in our reverse function, okay?
To fix this, we use a process called debugging,
which is essentially finding, fixing,
and then preventing bugs.
So let's see how that works.
So the first step is to actually become aware
that there is some kind of bug,
because as I said, in a large application,
bugs can actually go undiscovered for years.
Now, discovering bugs usually happens
during development using automated testing software
or user reports during production.
And bugs that are identified during production
are the worst bugs,
because it means that they went undiscovered
during development and are now affecting
real users of our application.
So that's why it's really important
to identify bugs early,
for example, using automated tests.
Now, while identifying the bug,
sometimes we also need to take into consideration
the context in which the bug happened.
For example, certain bugs might only happen
in a certain browser,
or only for certain users, for some reason.
Next, once we know there is a bug,
we need to go into our code and find the bug.
We need to isolate where exactly it's happening,
and we can do that using the developer console
that we already know.
However, that only works for small bugs
and simple code where we have a good idea
where the bug might be located.
But if the code is more complex
and we have no idea where the bug might be,
then we need to use a debugger software.
And I will show you how that works in the next video
because it's really important for developer
to be able to use a debugger.
Anyway, once we know where the bug is located,
we can finally fix it so we can correct the bug.
And this is probably the easiest part.
So essentially, all we need to do
is to replace the existing, so the wrong solution,
with a new correct solution that actually works.
As a final step, we should then prevent this bug
from ever happening again in our code base.
For example, we can search our project
for the same bug in similar code,
like in a similar function.
It's totally possible that we did the same mistake
twice in our code,
and if that's the case,
we must fix the bug everywhere.
A more advanced way of preventing bugs
is to write tests using testing software.
And I might add a bonus section on testing
to the course at some point
because this is actually an important part
of software development.
Okay, and that's it.
That's a broad overview of debugging in programming.
And we really just scratched the surface here,
because you're still at the beginning of the journey.
And so this is just an introduction.
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.