As someone that is indecisive and does not really like to cook, the question that I disliked being asked is what I want to eat, especially by my boyfriend. For whatever reason, dinnertime is the meal that we struggled to decide on the most. Fortunately, over time, we have developed staple recipes that we just rotate now cooking every week (for those that are curious, the recipes are curry, burgers, spaghetti, and chicken & rice). This has made deciding what to eat easier because we know these recipes are something we both like and are familiar with cooking. These staple recipes are analogous to design patterns in software engineering – reusable solutions to common problems that act as a guide for developers. Some common design patterns are Singleton and Factory. In singleton, only a single instance of a class can exists. In factory, objects are created, hiding the underlying logic. There are advantages and disadvantages for each design pattern. Overall, just like our staple recipes make cooking easier, design patterns can speed up the development process and improve code readability for developers.
Over the past few weeks, my classmates and I have been creating a website called Manoa Recipes, to address common food problems for college students: limited kitchen resources, limited cooking skills, limited time, limited access to grocery stores and no access to create recipes that respect these constraints. Before learning about design patterns, I initially thought design patterns were about the aesthetics of a website. I did not realize that when we were building this web application, we were already implementing some common design patterns. One design pattern is the Publish and Subscribe pattern, which is what Meteor is created on – it controls how Meteor servers publish sets of records and how clients can subscribe to them (the pub-sub model). Another design pattern we used was Singleton when building our collections in MongoDB.
Although design patterns does not provide an immediate solution to all of our coding problems, it can help the development process run more smoothly just like how recipes can make cooking easier.