Optimizations and tweaks
In computer programming, the term code bloat is commonly used to describe an unnecessarily long, slow, or wasteful amount of source code. Such code is hardly desirable because it inevitably makes our app more vulnerable to human errors, regression bugs, logical inconsistencies, wasted resources, and so on. It also makes debugging and testing a lot more difficult and stressful; for all of the previously mentioned reasons, we should try to prevent that from happening as much as we can.
The most effective way to counter code bloat is to adopt and adhere to the Don't Repeat Yourself (DRY) principle, which is something that any developer should try to follow whenever they can. As already stated in Chapter 5, Fetching and Displaying Data, DRY is a widely achieved principle of software development: whenever we violate it, we fall into a WET approach, which could mean Write Everything Twice, We Enjoy Typing, or Waste Everyone's Time, depending...