The brain is a prediction and pattern-matching machine. The upside to this is that we can quickly identify patterns amidst loads of information, the bad part is that we tend to assume things are related and part of a pattern but not necessarily so. Train yourself to assume things are not related and build things as if they are independent. The same principle applies to coding but also to thinking in general
Let’s say you are building a company, we might immediately assume success and profitability are tied together and come as a package. But that might not be the case, can a company be successful with their product, and loads of users, but not profitable? Certainly. This can induce a lot of unanticipated stress.
Let’s say we are building a new feature, we tend to usually assume y will always come after x, it has to, but is that really the case? Can users just use these two things independently?
Bug fixing is a similar story, we tend to come up with these awesome theories on why this bug is related to this part of the code, but more often than not, the bug is actually in another part of the code.
It’s a dream come true for software engineers to get a job offer at major software companies like Google, Apple, and Microsoft, but that might not mean you will enjoy the work there, it does not have to come in a package. Top companies and your ideal work environment there are two separate concepts.
This also applies to code, in fact, all SOLID principles of software engineering are specific techniques to achieve this very concept, to keep things separate because most concepts are not related and will grow independently, and if they are not treated as a separate entity will wreak havoc on the code base in the future.
Scientists have known this for a long time, in fact, rarely do you have strong evidence to assume things are causal. A common mistake is to think about outcomes A and B in this way: A comes before B, so B must be a result of A. When in fact, most of the things in science are just correlation and not causation. A and B are happening together or one after another but they don’t directly cause each other.
Examine your assumptions, especially if you assumed two or more things are related when in fact, they don’t have to be.