Gang of Four Programming Patterns

Posted by Chris Carter on January 17, 2021

Recently, I once again picked up the classic book on programming patterns titled Design Patterns: Elements of Reusable Object-Oriented Softwar. I have always enjoyed learning more about programming patterns. Many programmers will eventually come across these design patterns through reading, observing other people’s code, or discovering them on their own. I think this book can build a common language for other programmers to communicate with one another. From my personal experience as a programmer, I have found several principles that are very important to keep in mind when making decisions on the design and architecture of code.

Programming patterns can put a name to code design that other programmers can quickly recognize. For example, Singleton is one of the most popular programming patterns. It would be confusing for this pattern to take a different name, Singleton is already the universally accepted name (for example OneInstanceClass). It may take a little extra time thinking and designing code to make it easier to understand, but this extra time is a small price to pay for the time saved in the future when the code is required to expand and change. The code of a project is like a living being: it grows, expands, changes shape, and requires diligence to keep healthy. If code cannot be understood by the programmers easily and quickly, the programmers may have to strain themselves to understand it well, and there is also a chance of misunderstanding the code.

A well-skilled programmer is more valuable than the best IDE’s or tools available. Programmers that have experience with algorithms, design patterns, refactoring, unit testing, and software engineering will write code that is better than a programmer with the best tools but lacks this experience. Some programming patterns that I have been learning more about recently are the abstract factory, builder, prototype, and adapter. I hope to learn more about the factory method, chain of responsibility, command, momento, and visitor patterns soon. My goal has been to study at least one pattern a day. There are so many good books and blogs on programming patterns that I would enjoy diving deeper into.