When I started my journey as a computer programmer I had written my code in a various way. I met some condition and I just put the correct statement regardless of the general concept or something more deeply. “It works, that’s it” – and the code base grew and grew in time. Thousands of written methods later I had discovered that a lot of these little pieces of logic could look better if I reverse some condition within them. Unconsciously, I’ve started following the rule which I had later called the “fail fast” rule.
I realized I hadn’t had the one way to check conditions within the single method. Sometimes I let execution if the expression was true. Another time I had waited for the false result to show the error message before the main part of the code was executing. In my head, I discovered various styles of checking conditions.