Sometimes difficult problems become simple with just a slight change of perspective and a vigorous shake. Often the best way to fix nagging architectural problems is to turn our programs inside out. Of course there is (booming voice) Inversion of Control, and we’ll talk about that, but there are many other kinds of inside-out thinking. Sometimes it’s as simple as replacing a group of arrays with an array of structs. Sometimes we can swap subclasses and enums. Sometimes we can encapsulate and externalize our state (it may become necessary to say “monad;” I apologize in advance). We’ll explore several examples and the underlying concept behind them, duality, so you can discover inside-out patterns in your own code. The new shapes your programs take may surprise and delight.