Recipes in Coding

29 Nov 2023

The Recipe !

To be completely honest I did not know what design patterns were before being assigned this essay. Upon a little bit of research, though, I learned that a design pattern is essentially a solution to a certain type of problem that can be implemented and reused for other similar problems. In other words, it’s like a recipe!

To my understanding, the benefit of following standard design patterns comes in the form of structure, organization, and actually solving issues. Like a recipe, design patterns lay down the basic guidelines, the steps that the chef needs to follow in order to arrive at the final dish! In the same way that recipes can stretch across different cuisines and types of meals, design patterns can apply to many different categories within programming, like consistency, adaptability, problem solving, and sharing.

There can be a recipe for making code readable to everyone, not just your brain and its possible quirky way of thinking, for developing basic UIs for websites, for testing certain types of programs, or for building databases. These recipes create an industry standard that makes it easy to share and learn throughout the computer science community and gives people at all levels of experience and importance a strategy to follow in their endeavors. At their core, design pattern are a path to solving a problem, and like a recipe, they can be tweaked along the way to create solutions applicable to similar situations similar to how recipes can be changed to fit the tastebuds of the consumer.

My Secret Recipes!

Okay, I wouldn’t necessarily call them secrets. More like my personal collection of recipes! But either way, this semester I have started to collect and curate recipes that have helped me in solving the problems thrown at me in classes.

The main example that I can think of is how I practiced UI development in all the practice-WODS, assignments given to solve a coding problem that usually comes with a solution video, as it was something that we did over and over again and somewhat followed similar patterns. The problem solving design pattern I could come up with is: Creating the navbar Creating the main chunk of the page (main image, text blurbs, etc.) Creating the footer And in each one of these there were also smaller scale design patterns I used. Stuff like positioning navbar items a certain way or the way to implement images into the background.

Another example of using design patterns using ESLint to check the formatting of my code. I think that this plays into the readability factor of design patterns. ESLint is something that be installed into a coding platform that will force users to standardize their code to certain formatting. It will create errors for things like extra white space, incorrect indentation, and even the amount of characters allowed in one line. While it may a little cumbersome to deal with at the moment, not only does it develop good habits in keeping code neat, but the way it forces your code to be formatted also adds to the ease of readability when other people are looking at your code. Especially on projects that would require collaboration or a presentation of source code, following a design pattern here can be very useful.

Summary

In conclusion, though my own repertoire of recipes, otherwise known as design patterns, may be a bit shallow and on the beginner level, the benefit of following certain solutions and practices has already been displayed. I’d like to think that my cooking so far has provided ample tasting dishes that at the very least keep consumers from going hungry.

In the future I hope to expand my knowledge and learn more recipes in a wider variety of areas. I think especially in areas like algorithms, where problems can seem daunting, solutions can be found much easier by understanding and knowing common design patterns. Hopefully the more I learn in classes and on my own the more I design patterns I will also come to know, whether on purpose or not!