Рет қаралды 3,420
Today we are going to talk about a refactoring technique known as a guard clause. This technique is very easy to use, and allows us to avoid conditional complexity, or in other words, nested if else if,
in our code.
In this video we will see what guard clauses consist of, how to identify when we need to use them, and several examples of how to apply this technique.
----
TIMESTAMPS
----
Presentation (00:00)
Introduction (00:30)
How to identify if we need a guard clause (02:08)
Example: Problem to solve (02:50)
Example: Application of Guardian Clause (04:05)
Example: Refactoring the code (05:40)
Advantages of applying guard clauses (07:22)
Detractors of the guard clauses (08:20)
Conclusions (09:50)