As you continuously do coding homework and projects, you will notice after awhile that there are some lines of code that you can’t seem to run away from. The project may be like night and day - they differ completely - yet the coding that goes into it are somewhat similar. If you haven’t noticed it yet, you will eventually. That is what I would like to call a design pattern.
If you’ve used a coding language like Java, you already get the idea of what a design pattern is. You will be using things such as for and while loops over and over again because they are optimal. They do so much in such few lines that you can’t avoid using them. Instead of adding things to an array in 10 lines of code, you could use a loop and do it in 3 lines. Design patterns are meant to save you lots of time and will lower the total amount of effort needed to code something that may seem overwhelming at first.
In my own code, there are quite a few design patterns I can point out. In the recent coding I’ve done, I’ve had to access collections many times and use them in one way or another, including uses such as initializing sample data into the collection or having users add to them using a form. I wanted to try to run away from them, but even if I were to switch to a different page to work on, it would use a collection as well. I wanted to run away from collections because for me, they can sometimes be intimidating and confusing, but I eventually had to stop and tell myself “Confront your fear of collections. You can do it”.
Patterns are bound to happen in whatever you may do in life. A few other examples are knitting, working at a fast food restaurant, and your daily morning routine, so it’s no different when it comes to coding. It is best to work with design patterns and be optimal about it because they will save you lots of time. Once you’ve mastered a few design patterns and you have to debug your code, you can skim over your patterned code because you know so well that it works!