Make Your Programming Workflow More Efficient With Design Patterns

03 Dec 2020

Design Patterns are a Template

Writing essays has always been intimidating and frustrating for me, despite the fact that I have written tons of essays during my previous highschool and college years. Each time I have to write about an essay, I would tend to worry about whether I cited my work correctly, if the sentences I write are relevant to my arguments, or even if I remembered to include correct punctuation. The reason why I’m able to focus on these minor, but important aspects of my essay rather than thinking to myself “How do I even begin to write a proper essay?” is not only because of the experience I have accumulated writing essays in the past, but also because I understand the basic foundation of an essay: the introduction, body, and conclusion. While not all essays follow this format, it is perhaps the most common template that anyone can use to build upon and get the balling rolling. In the same way that I like to think of essay templates as a leeway to creating actual interesting essays, I would also like to discuss how design patterns act as the intermediary between you and clean code.

Design isn’t just about UI?

In the past three years of taking ICS courses, I have never heard about design patterns, and even after watching some screencasts and doing more research on it, some of the concepts are still somewhat vague to me. Additionally, as design patterns are a relatively new idea to me in programming, and there are several that I have been introduced to, I particularly find it difficult to identify when and which design pattern is ideal to use in order to solve a certain problem. My initial understanding and impressions led me to believe that design patterns are like a one-size-fits-all shirt that anyone can use and wear. However that isn’t the simple case, as while design patterns may end up solving a problem temporarily, in the long term it can potentially create even more unwanted problems for the programmer. Applying design patterns to each and every problem will just in turn become counterintuitive, and so you now have antipatterns that overdesign your code and make it harder for you and other programmers to understand.

One design pattern that I particularly like is the Model-View-Controller (MVC) pattern, as I believe I have been utilizing this pattern recently when developing the website for my ICS 314 final project. By definition, the MVC pattern splits the development work between different members of an organization into three main parts: the database, the visual elements, and the interactions that happen between database and visual elements. Splitting the responsibilities of building our website into these separate parts is neat, as I can work on the visual elements of our site without affecting or potentially breaking the other components.

Final Thoughts

Overall, I think that design patterns are very flexible and versatile in making my code more manageable. Additionally, it eases the programming workflow in that I don’t have to work at a problem from scratch, but rather I can use design patterns as a sort of blueprint or skeleton to build upon my actual solution. As I continue to expose myself to more design patterns I hope that with more experience and knowledge, I can effectively use design patterns for my future projects.