6 Things I Learned From My First Public WordPress Plugin
OOP Design Patterns: What are they and why use them?
Design Patterns are proven Object Oriented Programming (OOP) solutions that solve specific issues that most developers will experience in their programming careers. In my eyes the most famous Design Patterns book was written by the “Gang of Four” (Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides). This is one book that every developer should own: Design Patterns: Elements of Reusable Object-Oriented Software.
Knowing what publicized design patterns are available is crucial to becoming a high quality developer. Remember one of the goals of OOP is to reuse code and what better way than to use existing and proven solutions by some of the best developers out there. As a developer it’s important to remember that there have been thousands of developers before us dealing with similar issues who have already solved some of the most challenging coding issues out there. We must embrace what other developers have already learned. Knowing what Design Patterns are available to us is half the battle.
Several times in my career I was challenged to come up with solutions for coding problems that plagued other developers. I was fortunate to have studied many of the documented Design Patterns and was able to solve these issues quickly. I recall implementing the “Singleton” Design Pattern for a high volume system that was becoming sluggish and at times coming to a screeching halt because the server memory was being used up. After reviewing the code I found that some heavily used and expensive objects were unnecessarily being instantiated every time a process ran. After refactoring the code and implementing the Singleton design pattern so the objects could be reused, the server memory and processing was drastically reduced. The other developers had spent days trying to solve the issue by throwing more system memory at it and adding more servers to a cluster. All that time and money was lost because they did not know about OOP Design Patterns. I was able to solve this issue in just a few hours of development time thanks to the “Singleton” Design Pattern.
There are currenty no responses.