Application Design

25 Apr 2024

I think of design patterns as a guiding principles for developing. I mostly use creational design patterns in order to simplify my code. I think of it as a car factory. You want to make all different kinds of cars with different specifications, but there is a lot of overlap in the parts you’ll need and you often need to make multiple cars that have minute differences such as color. One approach would be to make every car from scratch, let’s say you get an order for a car so you go and build rims and tires for the wheels. And then you need to design and manufacture an engine and all of the other internal parts of the car before designing an exterior and interior and adding a radio, and safety features. The list goes on but you get the point, there is a lot of work that goes into every part of this process and every part of the car. The next time you get an order, you redo this whole process slightly differently to fit the requests. With this approach you are doing so much more work than necessary. In order to streamline this process you figure out a way to make wheels, a way to make engines, a way to make exteriors, etc, and you repeat this process over and over again and then combine these parts to meet the requests. This way you don’t need to design an engine every time someone orders a car. This is the power of design patterns. Any process that you might need to reuse, you generalize and make it reusable. This is one of my favorite approaches to programming as it makes it super easy to scale applications and processes.

Design patterns have been incredibly useful for me to develop more efficiently. There is no reason not to make use of established patterns and practices since that makes your programs more understandable to others and if you become familiar with certain design patterns it makes your code more maintainable since if you come back to it, knowing its design patterns will give you a good grasp on how it is structured and how different components work together. They also have allowed me to learn how to implement certain concepts such as modules, static imports, and publish-subscribe. Being able to make use of these patterns has definitely helped me become a better developer and helped me to understand how other applications work.