Design Patterns

27 Apr 2023

Instructions

When a restaurant wants to franchise its business, it still wants to preserve its unique feeling in different parts of the world. It has a brand to keep up, and if their franchises are not up to par, that brand’s reputation could fall. If you were to own this hypothetical restaurant, how would you try to solve this issue? In broader terms, how do you take similar places that will have similar problems and efficiently solve those problems. As quoted from Christopher Alexander, 1977 from the material of this section, [A design pattern] “describes a problem that occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice.” The way I interpret design patterns, problems will repeat and while it may not look like it, problems may have similar structure. So describing solutions in such a way that it solves all those problems with one well written process can save you time and allow you to accomplish your goals faster. While it may seem cumbersome to do this and instead make your solutions on a case to case basis, why trouble yourself and adapt solutions to make your life easier. Similar to something like a black box it allows you to spend more time thinking about the real problems and leave the minimal problems to the design patterns.

Examples

With the material covered for this section, many different examples of design patterns were explained, each with their own pros and cons. One example is a factory which deals with the problem of making objects in programming. With regular constructors, you can make an object of a class, but with a factory you can have a “factory” for shapes which returns a shape that is desired. Something similar to inheritance where you can make shape objects with a shape being circles or squares. Both are shapes, but a circle is not a square. Objects are prominent in computer programming, so developing solutions for making objects is useful.

How I’ve used it

I have utilized design patterns with the final project for ICS 314. Relying on these solutions for common problems has made coding a lot easier. Being able to set aside my thought power to parts of a problem where it is needed more has saved me hassle when coding. A restaurant will have similar problems across other restaurants. If we were to franchise a restaurant we can break down the seemingly different problems and set them aside to see if some problems are similar. Once you have your groupings, you can then develop broad solutions that can apply to the similar type of question.