How to survive a lightning strike

27 Apr 2023

</img> As a coder, you need to be able to efficiently use your time and your money to be able to come up with a solution to any problem your employer may throw at you (sometimes literally.) If a coder is unable to do these things, they’ll likely go insane and get tinnitus from all of the unnecessary typing. Putting aside the scary stories we’ll all tell our kids, it is obviously extremely important to be able to solve any problem that is thrown at you, especially now that there’s AI’s that could literally just do it for you if you can’t. However, most coders don’t just memorize the solutions to problems. Every human being has certain things they do if they’re put in a situation they’re familiar with. If you’ve gone down a dark alley and gotten mugged, most people would either not go through that dark alley, or bring a trusty can of mace. Coders do something similar.

What are design patterns?

“What are design patterns?” is a boring question obviously, but it becomes a point later, don’t leave yet. When a person has a goal, their subconscious uses everything in its power to help achieve that goal. Whether the conscious decides to use all of that hard work is obviously up to the person, but the subconscious will actively go up to all of your memories, scan them, run a for loop over all of them, if you will, and find any relevant information. If you went swimming once, but only kind of learned the basics, and then 20 years later, you get thrown out of a building into a lake, you’re gonna do those same movements you learned 20 years ago. It’s a completely different situation, you’re not in a pool learning how to swim anymore, but your brain has decided that the information from then was important for now. We might not even notice how often our brain does this, and sometimes it’s even wrong. This simple fact of human behavior is part of the reason why racial profiling exists. If you see 99 blonde people taking the lettuce off of their burgers, then you’ll likely expect the 100th to do the same. Programmers have to take this simple behavior of all human beings, and not only understand it, but shape it to be exactly what they want, so that there isn’t the failure rate, or any “Causation Vs. Correlation” fallacies. As a coder, you have to sift through information, and understand general solutions that can solve a plethora of problems. Only this way can you achieve the efficiency that you need, only this way can you possibly manage to even think about the goal of being able to solve every coding problem thrown your way.

How do I use design patterns?

Well I hope you haven’t left, because I’m getting to the point here, I just used a “design pattern” on you, the reader. My goal is to have you at least read the entirety of this paper, and hopefully get a good grade because of it. In my experience, the thing that people hate the most is cliff hangers, because they just have to know what happens. In my personal experience, a cliffhanger, as long as not overused, is a great way to garner someone’s attention over a long period of time. So I created a situation where I left a cliffhanger. You likely saw these two questions, the very questions we were instructed NEVER to use under ANY circumstances, and wanted to know why. Not only did I attempt to use a cliffhanger, I also attempted to use a very “clickbaity” title, meant to peak your curiosity. Obviously if you’re not reading this paragraph, I’m wrong, but it doesn’t matter anyway, because you’re not reading it. Either way, I attempted to use the knowledge that I’ve accumulated before in this situation, which is the exact definition of a (non-coding related) design pattern. In terms of coding, I’ve made many general solutions for problems that I either know are going to come up in the future or problems that I need to solve. I’ve always kept in my heart that a general solution is better than a specific one, because you can use the general solution in any way you want, in order to reach the specific solution you need. Not only that, but a general solution that works for 20 different problems is a lot easier to remember than 20 different solutions that are more specialized.I have also used the ideal many times in creating algorithms, as many algorithms are very similar, or use very similar foundations to others.

Fin

If you’re still reading this by now, cool, I guess I did good, if not, because my paragraph titles scared you off, then I guess my plan didn’t work.