It’s 2021, and there’s a global chip shortage! So, what does this mean for you? It means that getting your hands on that coveted new RTX 3080 graphics card requires paying a hefty premium to scalpers. But fear not, because I have a solution that doesn’t involve selling a kidney on the black market. Brace yourself, because the answer lies in two simple words: Design Patterns. Surprised? Let me explain how it all comes together.
In essence, a design pattern is a reusable solution that addresses recurring problems. Our problem is the rapid depletion of graphics cards from the market within minutes of restocking. Online retailers like Zotac, BestBuy, Amazon, and Walmart all struggle with this issue. By leveraging the observer design pattern and event handlers, you can develop a bot that monitors these websites and takes action when it detects changes. It’s as straightforward as that! And because I know you’re looking for convenience, I’ve got you covered with a ready-made solution. Just click here and follow the instructions on GitHub. This open-source bot refreshes Amazon listings and attempts to purchase the item if it falls within the specified price range. Now, go ahead, save an RTX 3080 graphics card from its potential fate as an Ethereum miner.
Perhaps you already possess a new graphics card, lack the funds to acquire one, or never needed one in the first place. If that’s the case, allow me to captivate your attention further by extolling the virtues of design patterns and how I’ve been utilizing them.
The observer design pattern is just one among many in the vast realm of design patterns. There are more widely known ones like factory, singleton, and MVC (Model-View-Controller). While I won’t delve into the details of each, I wanted to shed some light on MVC. MVC stands for Model-View-Controller, and if you’ve dabbled in web development or user interfaces, chances are you’ve encountered this pattern before. It consists of the model, which encapsulates application states; the controller, responsible for defining application behavior; and the view, handling rendering tasks.
In my case, I’ve employed MVC when working with Meteor and currently utilize it for our UH-Ratings GitHub project. MongoDB serves as the model, React Router as the controller, and React as the view. Together, they harmoniously fetch and display data on the website. While I consider myself relatively new to this topic, I encourage you to explore and familiarize yourself with other design patterns available.