The lazy mindset
First, it is very important to understand the lazy pattern, how it works, how it could benefit an application's performance, and when to use it. It's also very important not to abuse it, because that would make code more complex and hard to read. Plus, it would be hard to follow the execution flow. Also, abusing it would decrease the overall application's performance.
The general idea of a lazy pattern is to defer the evaluation of an instruction until someone asks for the result of that instruction.
In general, code is executed instruction by instruction, starting at the top of a file or a function. Nowadays, our applications are more complex and consist of many files, windows, libraries, components, and layers, but they still execute code in the same way. Because our system gets bigger and bigger, it's important to make them lazy so that we don't have to perform all the work when we start the application. Let's learn a few techniques for making code lazy.
Separation
It's very...