Design Patterns at Work!

27 Apr 2023

DesignPatterns



Introduction

Have you ever experience working on a project from scratch? Have you tried cooking without reading the recipe? Can a software engineer use a template to solve a particular programming problem? Having a reference to look at before starting a project, cooking food, and software design is very helpful and can make the task easier to work on.

What are design patterns?

Design patterns are repetitive or reusable solution to a commonly encountered problem in software design. It is considered as a template or description on how to solve a particular problem in many type of situations. There are different types of design patterns that I have encountered in this class. Prototype design pattern was the first type that I encountered when I used Javascript where I created a new object from an existing object. When I learned about Meteor, there are several design patterns were applied such as Observer, MVC, and Front Controller. An example of Observer design pattern that I used was when I create a MongoDB collection. Once I updated the collection, the code that reference a cursor in that specific collection will re-run. An example of MVC in Meteor is the MongoDB collection being the model, the view is the template (Blaze), and the controller is the Flow Router. When we discussed about Bowfolios, the design pattern that we applied are Singleton and Factory Method.

Generalization

In conclusion, design patterns are template to solve a commonly encountered problem in software design that you can reuse. There are different types of design patterns such as Prototype, Observer, MVC, Front Controller, Singleton, and Factory Method. Like any other profession, having a reference to a particular problem can be of great help and can make ite easier in working on a task and that is why design patterns are here for.