Programming is the art of translation.
Taking an idea, a concept, a vision, a problem solution, and codifying it into something a machine can “understand”? Sure, but the extent of a machine’s understanding is that of a hand calculator. A computer follows instructions just as a river follows the path from the high ground to the low. So, to expand the statement, programming is the art of translation of an idea to instruction — a repeatable list of commands to be executed with inputs and contingencies to handle.
When doing something over and over to try to solve a problem, you start to see repeat behaviors. These can be boxed up and grouped together into reusable components. This is the essence of most modern — and certainly Object-oriented — programming. We can create encapsulations around common functionality like grabbing input from a keyboard or drawing something on a screen. We can then box up these components into larger and larger systems of components. And thus we arrive at the heart of this blog series: Patterns.
Patterns are repeatable structures that are abstracted from specific implementations. In this series, I’m going to discuss a number of different patterns and their uses. I’ll refer to the quintessential “Gang of Four” patterns as well as some of patterns by Martin Fowler and some generic patterns that I’ve used in the trenches.
More specifically, I’ll cover patterns such as the Observer, the Decorator, the Façade, the Singleton, and the Factory. I’ll also discuss the GoF’s principles of reusable object-oriented design. Namely:
- Program to an interface, not an implementation
- Favor object composition over class inheritance
I’ll also try and provide as many reference examples as possible and specific use cases. By the end, we’ll hopefully have journeyed together to a greater understanding of patterned software development and assembled an open source library of code snippets that can be referenced and used in our day-to-day development efforts.
Your friend in code, Lazybaer