Archive: August, 2021

Inverse Logic Pattern

August 20, 2021
Tags: Logic

When I first started programming I learned the basic set of logic controls and began doing what came naturally. As you can expect, inexperience can often lead to poor practices. Over time I began to realize that programming was much less about writing code and much more about composing legible, comprehensible webs of tasks. Most often experience and training will seem intuitive in retrospect but occasionally the best solution to a problem is the opposite of what you expect to do. In this case what I learned was that much of what I was taught about methods, loops and logic were backwards. In fact the best way to work was inverted. 

Thanks to a friend I also was recently informed that these are called 'Guard Statements'