Design Patterns in Software Engineering

29 Nov 2023

Creating high-quality and efficient applications is crucial to software engineering. To keep strong and consistent results, we use design patters, which are a blueprint for how an application should be created. One of the most common examples of these design patterns is something we have used in almost every project in this class. Encapsulation is when we bundle data in another file so we can bring that structured data into other places in our code. Encapsulation is especially useful in our Javascript applications because it helps us not only organize our project, but also only share access between files when requested. Another good example are structural design patterns. For example, a weapon class in a video game: the highest class would have logic that would run on each weapon, the next row being logic on if the weapon was melee or ranged, and so on until you reach the weapon specific class. In some of my other projects I also commonly use design patters such as state machines and singletons to control the flow of my application or game. State machines change behaviour of the code depending on external factors, and singletons are super useful because they only run one instance of the code at a time.