In this video, we will explain how you can use guard clauses to make your code more readable. After setting the stage and looking at what Code Smells and Refactoring are, we will now see how we can refactor code with too many levels of indentation, analyze the concept of "mental stack" that we, as developers, need to maintain when programming, and check how we can bring error handling closer to detection, all in order to enhance the readability of our code :)
Related Material
- Replace Nested Conditional with Guard Clauses (Article by Martin Fowler)
- Replace Nested Conditional with Guard Clauses (Example of the process to follow from Refactoring.guru)