## Design Pattern Categories * **Creational Patterns**: provide more flexibility in how the objects are actually created. * **Structural Patterns**: deal with how inheritance and composition can be used to provide extra functionality. * **Behavioral Patterns**: are about communication and assignment of responsibilities between our objects. ## Object Oriented Principles ### Identify the aspects of your application that vary and separate them from what stays the same If you have some aspect of your code that is changing say with every new requirement, then you know you've got a behavior that needs to be pulled out and separated from all the stuff that doesn't change. Encapsulating the parts that change helps us later alter or extend the parts that vary without affecting those that don't. ### Program to an interface, not an implementation Interfaces allow us to exploit polymorphism by programming to a supertype so that the actual runtime object isn't locked into the code. ### Favor composition over inheritance Composition offers a lot more flexibility. It allows us to encapsulate a family of algorithms into their own set of classes and change behavior at runtime as long as the object we are composing with implements the correct behavior interface. ### Strive for loosely coupled designs between objects that interact When objects are loosely coupled, they can interact, but they typically have very little knowledge of each other. As a result, we achieve systems that can handle change because the interdependency between objects is minimized. ### Classes should be open for extension, but closed for modification * One benefit of following this principle is that we obtain designs that are resilient to change and flexible enough to take on new functionality to meet changing requirements. * Following the open close principle introduces new level of abstraction, which adds complexity to the code. * We should only focus on the areas that are most likely to change in the design and apply the principle there instead of trying to apply it everywhere.