Design patterns to save the day

30 Apr 2020

Do you want to build a house? Well, where should you start? Besides calling up an architect and paying him to build a house for you, you first need to decide what kind of house you want. This is where design patterns come in. Design patterns are a template solution to a specific problem. These solutions are applicable and usable for the problem that it was intending to solve and is general enough to implement into any variation of that problem. Although I’m talking about building a house, design patterns are the core of any design process, including software engineering. So where should you start?

Well there are a few things you need to know about design patterns

First, design patterns are designed in a way that solves the problem in the subject matter you’re talking about. A better way to understand this is by asking yourself what the problem is. In the case of the architect, the first thing he looks at is the problem. Where is the building going to be located? You can only build certain types of buildings/houses in an urban area, and it would be very challenging to build a 50 story skyscraper in the middle of Manoa valley. There are many things that the architect needs to take into consideration and knowing the problems beforehand can help decide on the design pattern he will use. In the case of the software engineer, the problem could be anything. It’s up to the engineer to pick the best design pattern to fit his needs.

Second, design patterns might not always be the best solution to your problem. Each design pattern has its pros and cons, and just because one design pattern fits your problem, it doesn’t mean that you’re using the best solution. Finally, design patterns are just a template explaining a method to solve the problem. Just because you have the exact same problem as the guy you’re sitting next to, there is a variation to each design pattern even though conceptually they may be the same.

Different types of design patterns in Software Engineering

Software engineers come across many types of ‘problems’ when building their applications, therefore they can use many different types of design patterns. Oh, you wanna create multiple types of objects from different classes? Use a factory! Oh, you need to keep track of events and have them call to other classes? Take an observer! Oh, you’re creating a user interface and have specialized people for development? An MVC is right for you!

Design patterns are everywhere in software development and again, let me reiterate design patterns are the core of any design process! Without them, your problems won’t be solved efficiently.

My experience with design patterns

Before learning that design patterns were even a thing, I have used and experienced them many times in my homework assignments/projects. One that I used quite a bit in ICS 314 was the MVC or Model-View-Controller. At the time, I didn’t know I was using it, but it taught me to make sure that the pages were communicating with the database. In the homework assignments, everything that we built was very compartmentalized and matched up to the MVC design pattern to a T. In my final project, I’m doing the same thing by partitioning the collections from the presentation and we’re doing this by using the Observer design pattern by publishing and subscribing to a collection.

To finish it off!

There are many design patterns for multiple sets of problems, in many different subject areas. Design patterns are crucial when developing anything whether it be a house or an application. It sets the groundwork for any noteworthy project and helps point you in the right direction.